From: Aaron Schulz Date: Sun, 19 Oct 2014 02:47:22 +0000 (-0700) Subject: Switch to LOCK IN SHARE MODE in recordUpload2() X-Git-Tag: 1.31.0-rc.0~13457 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=17cc78767ab099f9d00d267f230be81c202b1795;p=lhc%2Fweb%2Fwiklou.git Switch to LOCK IN SHARE MODE in recordUpload2() * We just need the latest data; the advisory locking in lock() already manages mutual exclusion. Change-Id: I9af7a892b2dcafd30149332b0084f61d117c9cad --- diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 08c9afb18e..9f1466955a 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1303,9 +1303,11 @@ class LocalFile extends File { ); if ( $dbw->affectedRows() == 0 ) { if ( $allowTimeKludge ) { - # Use FOR UPDATE to ignore any transaction snapshotting + # Use LOCK IN SHARE MODE to ignore any transaction snapshotting $ltimestamp = $dbw->selectField( 'image', 'img_timestamp', - array( 'img_name' => $this->getName() ), __METHOD__, array( 'FOR UPDATE' ) ); + array( 'img_name' => $this->getName() ), + __METHOD__, + array( 'LOCK IN SHARE MODE' ) ); $lUnixtime = $ltimestamp ? wfTimestamp( TS_UNIX, $ltimestamp ) : false; # Avoid a timestamp that is not newer than the last version # TODO: the image/oldimage tables should be like page/revision with an ID field