From: Aaron Schulz Date: Wed, 8 Apr 2015 01:11:29 +0000 (-0700) Subject: Log huge write queries in CLI scripts X-Git-Tag: 1.31.0-rc.0~11783^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=ea5f44587a4d554154783f92cde82b7ac919130f;p=lhc%2Fweb%2Fwiklou.git Log huge write queries in CLI scripts * This is already done for web scripts, but with lower limits Bug: T95382 Change-Id: I0fe14bcdaebc3568b0cb7af8084b7bfefeb82826 --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index a0ffcb2b15..a8dbd5f280 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -38,6 +38,8 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless $maintClass = false; +use MediaWiki\Logger\LoggerFactory; + /** * Abstract maintenance class for quickly writing and churning out * maintenance scripts with minimal effort. All that _must_ be defined @@ -612,6 +614,11 @@ abstract class Maintenance { $profiler->setTemplated( true ); Profiler::replaceStubInstance( $profiler ); } + + $trxProfiler = Profiler::instance()->getTransactionProfiler(); + $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) ); + # Catch huge single updates that lead to slave lag + $trxProfiler->setExpectation( 'maxAffected', 1000, __METHOD__ ); } /**