From c5cba0ea15b2fe5e0fa6d72983af59bc6b899ed0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 22 Sep 2016 17:03:51 -0700 Subject: [PATCH] Call setTransactionTicket() on DeferredUpdates sub-queue items too This should lower the rate of "does not have outer scope" log warnings in DBPerformance. Also add traces to such logs. Change-Id: I7d21ea745cae07e0fbbe4cd8de82e93f1d10e0a5 --- includes/deferred/DeferredUpdates.php | 4 ++++ includes/libs/rdbms/lbfactory/LBFactory.php | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/includes/deferred/DeferredUpdates.php b/includes/deferred/DeferredUpdates.php index d24ebde7d6..8a761f516f 100644 --- a/includes/deferred/DeferredUpdates.php +++ b/includes/deferred/DeferredUpdates.php @@ -214,6 +214,10 @@ class DeferredUpdates { $firstKey = key( self::$executeContext['subqueue'] ); unset( self::$executeContext['subqueue'][$firstKey] ); + if ( $subUpdate instanceof DataUpdate ) { + $subUpdate->setTransactionTicket( $ticket ); + } + $guiError = self::runUpdate( $subUpdate, $lbFactory, $stage ); $reportableError = $reportableError ?: $guiError; } diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php b/includes/libs/rdbms/lbfactory/LBFactory.php index d75ba931ee..aa932aadac 100644 --- a/includes/libs/rdbms/lbfactory/LBFactory.php +++ b/includes/libs/rdbms/lbfactory/LBFactory.php @@ -519,7 +519,9 @@ abstract class LBFactory { */ public function getEmptyTransactionTicket( $fname ) { if ( $this->hasMasterChanges() ) { - $this->queryLogger->error( __METHOD__ . ": $fname does not have outer scope." ); + $this->queryLogger->error( __METHOD__ . ": $fname does not have outer scope.\n" . + ( new RuntimeException() )->getTraceAsString() ); + return null; } @@ -539,7 +541,9 @@ abstract class LBFactory { */ public function commitAndWaitForReplication( $fname, $ticket, array $opts = [] ) { if ( $ticket !== $this->ticket ) { - $this->perfLogger->error( __METHOD__ . ": $fname does not have outer scope." ); + $this->perfLogger->error( __METHOD__ . ": $fname does not have outer scope.\n" . + ( new RuntimeException() )->getTraceAsString() ); + return; } -- 2.20.1