Warn when jobs do large DB writes at once
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 8 Apr 2015 22:47:58 +0000 (15:47 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 8 Apr 2015 22:47:58 +0000 (15:47 -0700)
Change-Id: I57e9bb630accd5b262188ab16b17b558cd3a2bc1

includes/jobqueue/JobRunner.php

index b8c5d6c..f808a32 100644 (file)
@@ -117,6 +117,11 @@ class JobRunner implements LoggerAwareInterface {
                        return $response;
                }
 
+               // Catch huge single updates that lead to slave lag
+               $trxProfiler = Profiler::instance()->getTransactionProfiler();
+               $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) );
+               $trxProfiler->setExpectation( 'maxAffected', 500, __METHOD__ );
+
                // Bail out if there is too much DB lag
                list( , $maxLag ) = wfGetLBFactory()->getMainLB( wfWikiID() )->getMaxLag();
                if ( $maxLag >= 5 ) {