Aaron Schulz has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/350509 )
Change subject: Release prior row locks beforehand in LinksUpdate::updateCategoryCounts ...................................................................... Release prior row locks beforehand in LinksUpdate::updateCategoryCounts Bug: T163801 Change-Id: I6a026ee9a249da5a8fd9ceb216416340a9188d3f --- M includes/deferred/LinksUpdate.php 1 file changed, 13 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/09/350509/1 diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index a629458..072c1e0 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -364,21 +364,24 @@ private function updateCategoryCounts( array $added, array $deleted ) { global $wgUpdateRowsPerQuery; + if ( !$added && !$deleted ) { + return; + } + + $wikiId = $this->getDB()->getWikiID(); $wp = WikiPage::factory( $this->mTitle ); - $factory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $lbf = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + // T163801: try to release any row locks to reduce contention + $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] ); foreach ( array_chunk( array_keys( $added ), $wgUpdateRowsPerQuery ) as $addBatch ) { $wp->updateCategoryCounts( $addBatch, [], $this->mId ); - $factory->commitAndWaitForReplication( - __METHOD__, $this->ticket, [ 'wiki' => $this->getDB()->getWikiID() ] - ); + $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] ); } foreach ( array_chunk( array_keys( $deleted ), $wgUpdateRowsPerQuery ) as $deleteBatch ) { $wp->updateCategoryCounts( [], $deleteBatch, $this->mId ); - $factory->commitAndWaitForReplication( - __METHOD__, $this->ticket, [ 'wiki' => $this->getDB()->getWikiID() ] - ); + $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $wikiId ] ); } } @@ -399,7 +402,7 @@ private function incrTableUpdate( $table, $prefix, $deletions, $insertions ) { $services = MediaWikiServices::getInstance(); $bSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' ); - $factory = $services->getDBLoadBalancerFactory(); + $lbf = $services->getDBLoadBalancerFactory(); if ( $table === 'page_props' ) { $fromField = 'pp_page'; @@ -451,7 +454,7 @@ foreach ( $deleteWheres as $deleteWhere ) { $this->getDB()->delete( $table, $deleteWhere, __METHOD__ ); - $factory->commitAndWaitForReplication( + $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $this->getDB()->getWikiID() ] ); } @@ -459,7 +462,7 @@ $insertBatches = array_chunk( $insertions, $bSize ); foreach ( $insertBatches as $insertBatch ) { $this->getDB()->insert( $table, $insertBatch, __METHOD__, 'IGNORE' ); - $factory->commitAndWaitForReplication( + $lbf->commitAndWaitForReplication( __METHOD__, $this->ticket, [ 'wiki' => $this->getDB()->getWikiID() ] ); } -- To view, visit https://gerrit.wikimedia.org/r/350509 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6a026ee9a249da5a8fd9ceb216416340a9188d3f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits