From: Sam Reed Date: Mon, 11 Apr 2011 13:02:55 +0000 (+0000) Subject: * (bug 27639) Transaction timeout when trying to OldLocalFile::upgradeRow() X-Git-Tag: 1.31.0-rc.0~30939 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=3eeb862a7379fd50e55428bd5a84b8a838deba0a;p=lhc%2Fweb%2Fwiklou.git * (bug 27639) Transaction timeout when trying to OldLocalFile::upgradeRow() --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c8ac6873bc..2efe905591 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -238,6 +238,7 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 28485) Block::purgeExpired Database returned error "1205: Lock wait timeout exceeded;" * (bug 20468) User::invalidateCache throws 1205: Lock wait timeout exceeded +* (bug 27639) Transaction timeout when trying to OldLocalFile::upgradeRow() === API changes in 1.18 === * (bug 26339) Throw warning when truncating an overlarge API result diff --git a/includes/filerepo/OldLocalFile.php b/includes/filerepo/OldLocalFile.php index 16b4cd7901..2b1cddda3e 100644 --- a/includes/filerepo/OldLocalFile.php +++ b/includes/filerepo/OldLocalFile.php @@ -160,9 +160,13 @@ class OldLocalFile extends LocalFile { return; } - $dbw = $this->repo->getMasterDB(); list( $major, $minor ) = self::splitMime( $this->mime ); + // https://bugzilla.wikimedia.org/show_bug.cgi?id=27639 + // Create and use a new loadBalancer object, to prevent "1205: Lock wait timeout exceeded;" + $lb = wfGetLBFactory()->newMainLB(); + $dbw = $lb->getConnection( DB_MASTER ); + wfDebug(__METHOD__.': upgrading '.$this->archive_name." to the current schema\n"); $dbw->update( 'oldimage', array( @@ -179,6 +183,9 @@ class OldLocalFile extends LocalFile { 'oi_archive_name' => $this->archive_name ), __METHOD__ ); + + $lb->commitMasterChanges(); + $lb->closeAll(); wfProfileOut( __METHOD__ ); }