From: Aaron Schulz Date: Wed, 18 Feb 2015 00:50:12 +0000 (-0800) Subject: Made TransactionProfiler affected-row warnings not trigger for JobRunner X-Git-Tag: 1.31.0-rc.0~12371^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=b403a757726eaa61fa08af39347d75bd89a5d39c;p=lhc%2Fweb%2Fwiklou.git Made TransactionProfiler affected-row warnings not trigger for JobRunner * The CLI check did not work since jobs can work via HTTP requests Change-Id: I524e79fd51275777c1505e29ecf0725b998eabcc --- diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 2a0a405b6b..c21f5e9696 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -497,6 +497,7 @@ class MediaWiki { $trxProfiler = Profiler::instance()->getTransactionProfiler(); $trxProfiler->setExpectation( 'masterConns', 0, __METHOD__ ); $trxProfiler->setExpectation( 'writes', 0, __METHOD__ ); + $trxProfiler->setExpectation( 'maxAffected', 500, __METHOD__ ); } // If the user has forceHTTPS set to true, or if the user diff --git a/includes/profiler/TransactionProfiler.php b/includes/profiler/TransactionProfiler.php index 9609bd318f..b3135585f9 100644 --- a/includes/profiler/TransactionProfiler.php +++ b/includes/profiler/TransactionProfiler.php @@ -34,8 +34,6 @@ class TransactionProfiler { protected $dbLockThreshold = 3.0; /** @var float Seconds */ protected $eventThreshold = .25; - /** @var integer */ - protected $affectedThreshold = 500; /** @var array transaction ID => (write start time, list of DBs involved) */ protected $dbTrxHoldingLocks = array(); @@ -54,7 +52,8 @@ class TransactionProfiler { 'writes' => INF, 'queries' => INF, 'conns' => INF, - 'masterConns' => INF + 'masterConns' => INF, + 'maxAffected' => INF ); /** @var array */ protected $expectBy = array(); @@ -154,9 +153,9 @@ class TransactionProfiler { $eTime = microtime( true ); $elapsed = ( $eTime - $sTime ); - if ( $isWrite && $n > $this->affectedThreshold && PHP_SAPI !== 'cli' ) { + if ( $isWrite && $n > $this->expect['maxAffected'] ) { wfDebugLog( 'DBPerformance', - "Query affected $n rows:\n" . $query . "\n" . wfBacktrace( true ) ); + "Query affected $n row(s):\n" . $query . "\n" . wfBacktrace( true ) ); } // Report when too many writes/queries happen...