From b403a757726eaa61fa08af39347d75bd89a5d39c Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 17 Feb 2015 16:50:12 -0800 Subject: [PATCH] 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 --- includes/MediaWiki.php | 1 + includes/profiler/TransactionProfiler.php | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) 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... -- 2.20.1