From ea5f44587a4d554154783f92cde82b7ac919130f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 7 Apr 2015 18:11:29 -0700 Subject: [PATCH] Log huge write queries in CLI scripts * This is already done for web scripts, but with lower limits Bug: T95382 Change-Id: I0fe14bcdaebc3568b0cb7af8084b7bfefeb82826 --- maintenance/Maintenance.php | 7 +++++++ 1 file changed, 7 insertions(+) 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__ ); } /** -- 2.20.1