Call setTransactionTicket() on DeferredUpdates sub-queue items too
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Sep 2016 00:03:51 +0000 (17:03 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Sep 2016 00:03:56 +0000 (17:03 -0700)
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
includes/libs/rdbms/lbfactory/LBFactory.php

index d24ebde..8a761f5 100644 (file)
@@ -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;
                                        }
index d75ba93..aa932aa 100644 (file)
@@ -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;
                }