r85785 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85784‎ | r85785 | r85786 >
Date:13:07, 11 April 2011
Author:reedy
Status:reverted
Tags:
Comment:
* (bug 13921) deadlocks mass-deleting media files in categories
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -4420,8 +4420,12 @@
44214421 */
44224422 public function updateCategoryCounts( $added, $deleted ) {
44234423 $ns = $this->mTitle->getNamespace();
4424 - $dbw = wfGetDB( DB_MASTER );
44254424
 4425+ // https://bugzilla.wikimedia.org/show_bug.cgi?id=13921
 4426+ // Create and use a new loadBalancer object, to prevent "1205: Lock wait timeout exceeded;"
 4427+ $lb = wfGetLBFactory()->newMainLB();
 4428+ $dbw = $lb->getConnection( DB_MASTER );
 4429+
44264430 # First make sure the rows exist. If one of the "deleted" ones didn't
44274431 # exist, we might legitimately not create it, but it's simpler to just
44284432 # create it and then give it a negative value, since the value is bogus
@@ -4472,6 +4476,9 @@
44734477 __METHOD__
44744478 );
44754479 }
 4480+
 4481+ $lb->commitMasterChanges();
 4482+ $lb->closeAll();
44764483 }
44774484
44784485 /**
Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -1508,9 +1508,13 @@
15091509 }
15101510
15111511 function doDBDeletes() {
1512 - $dbw = $this->file->repo->getMasterDB();
15131512 list( $oldRels, $deleteCurrent ) = $this->getOldRels();
15141513
 1514+ // https://bugzilla.wikimedia.org/show_bug.cgi?id=13921
 1515+ // Create and use a new loadBalancer object, to prevent "1205: Lock wait timeout exceeded;"
 1516+ $lb = wfGetLBFactory()->newMainLB();
 1517+ $dbw = $lb->getConnection( DB_MASTER );
 1518+
15151519 if ( count( $oldRels ) ) {
15161520 $dbw->delete( 'oldimage',
15171521 array(
@@ -1522,6 +1526,9 @@
15231527 if ( $deleteCurrent ) {
15241528 $dbw->delete( 'image', array( 'img_name' => $this->file->getName() ), __METHOD__ );
15251529 }
 1530+
 1531+ $lb->commitMasterChanges();
 1532+ $lb->closeAll();
15261533 }
15271534
15281535 /**
Index: trunk/phase3/RELEASE-NOTES
@@ -239,6 +239,7 @@
240240 exceeded;"
241241 * (bug 20468) User::invalidateCache throws 1205: Lock wait timeout exceeded
242242 * (bug 27639) Transaction timeout when trying to OldLocalFile::upgradeRow()
 243+* (bug 13921) deadlocks mass-deleting media files in categories
243244
244245 === API changes in 1.18 ===
245246 * (bug 26339) Throw warning when truncating an overlarge API result

Follow-up revisions

RevisionCommit summaryAuthorDate
r85814Revert r85785reedy18:46, 11 April 2011

Status & tagging log