exceeded;"
* (bug 20468) User::invalidateCache throws 1205: Lock wait timeout exceeded
* (bug 27639) Transaction timeout when trying to OldLocalFile::upgradeRow()
+* (bug 13921) deadlocks mass-deleting media files in categories
=== API changes in 1.18 ===
* (bug 26339) Throw warning when truncating an overlarge API result
*/
public function updateCategoryCounts( $added, $deleted ) {
$ns = $this->mTitle->getNamespace();
- $dbw = wfGetDB( DB_MASTER );
+
+ // https://bugzilla.wikimedia.org/show_bug.cgi?id=13921
+ // Create and use a new loadBalancer object, to prevent "1205: Lock wait timeout exceeded;"
+ $lb = wfGetLBFactory()->newMainLB();
+ $dbw = $lb->getConnection( DB_MASTER );
# First make sure the rows exist. If one of the "deleted" ones didn't
# exist, we might legitimately not create it, but it's simpler to just
__METHOD__
);
}
+
+ $lb->commitMasterChanges();
+ $lb->closeAll();
}
/**
}
function doDBDeletes() {
- $dbw = $this->file->repo->getMasterDB();
list( $oldRels, $deleteCurrent ) = $this->getOldRels();
+ // https://bugzilla.wikimedia.org/show_bug.cgi?id=13921
+ // Create and use a new loadBalancer object, to prevent "1205: Lock wait timeout exceeded;"
+ $lb = wfGetLBFactory()->newMainLB();
+ $dbw = $lb->getConnection( DB_MASTER );
+
if ( count( $oldRels ) ) {
$dbw->delete( 'oldimage',
array(
if ( $deleteCurrent ) {
$dbw->delete( 'image', array( 'img_name' => $this->file->getName() ), __METHOD__ );
}
+
+ $lb->commitMasterChanges();
+ $lb->closeAll();
}
/**