Index: trunk/phase3/includes/Article.php |
— | — | @@ -4420,8 +4420,12 @@ |
4421 | 4421 | */ |
4422 | 4422 | public function updateCategoryCounts( $added, $deleted ) { |
4423 | 4423 | $ns = $this->mTitle->getNamespace(); |
4424 | | - $dbw = wfGetDB( DB_MASTER ); |
4425 | 4424 | |
| 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 | + |
4426 | 4430 | # First make sure the rows exist. If one of the "deleted" ones didn't |
4427 | 4431 | # exist, we might legitimately not create it, but it's simpler to just |
4428 | 4432 | # create it and then give it a negative value, since the value is bogus |
— | — | @@ -4472,6 +4476,9 @@ |
4473 | 4477 | __METHOD__ |
4474 | 4478 | ); |
4475 | 4479 | } |
| 4480 | + |
| 4481 | + $lb->commitMasterChanges(); |
| 4482 | + $lb->closeAll(); |
4476 | 4483 | } |
4477 | 4484 | |
4478 | 4485 | /** |
Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -1508,9 +1508,13 @@ |
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | function doDBDeletes() { |
1512 | | - $dbw = $this->file->repo->getMasterDB(); |
1513 | 1512 | list( $oldRels, $deleteCurrent ) = $this->getOldRels(); |
1514 | 1513 | |
| 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 | + |
1515 | 1519 | if ( count( $oldRels ) ) { |
1516 | 1520 | $dbw->delete( 'oldimage', |
1517 | 1521 | array( |
— | — | @@ -1522,6 +1526,9 @@ |
1523 | 1527 | if ( $deleteCurrent ) { |
1524 | 1528 | $dbw->delete( 'image', array( 'img_name' => $this->file->getName() ), __METHOD__ ); |
1525 | 1529 | } |
| 1530 | + |
| 1531 | + $lb->commitMasterChanges(); |
| 1532 | + $lb->closeAll(); |
1526 | 1533 | } |
1527 | 1534 | |
1528 | 1535 | /** |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -239,6 +239,7 @@ |
240 | 240 | exceeded;" |
241 | 241 | * (bug 20468) User::invalidateCache throws 1205: Lock wait timeout exceeded |
242 | 242 | * (bug 27639) Transaction timeout when trying to OldLocalFile::upgradeRow() |
| 243 | +* (bug 13921) deadlocks mass-deleting media files in categories |
243 | 244 | |
244 | 245 | === API changes in 1.18 === |
245 | 246 | * (bug 26339) Throw warning when truncating an overlarge API result |