From 17cc78767ab099f9d00d267f230be81c202b1795 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 18 Oct 2014 19:47:22 -0700 Subject: [PATCH] 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 --- includes/filerepo/file/LocalFile.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.20.1