From: Aaron Schulz Date: Wed, 8 Apr 2015 22:47:58 +0000 (-0700) Subject: Warn when jobs do large DB writes at once X-Git-Tag: 1.31.0-rc.0~11772^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=fcb0872e8b0ec03f78a0f1094a5205c83dd52d45;p=lhc%2Fweb%2Fwiklou.git Warn when jobs do large DB writes at once Change-Id: I57e9bb630accd5b262188ab16b17b558cd3a2bc1 --- diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index b8c5d6cf78..f808a324cc 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -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 ) {