Switch to LOCK IN SHARE MODE in recordUpload2()
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 19 Oct 2014 02:47:22 +0000 (19:47 -0700)
committerSpringle <springle@wikimedia.org>
Wed, 29 Oct 2014 06:59:51 +0000 (06:59 +0000)
* We just need the latest data; the advisory locking in lock()
  already manages mutual exclusion.

Change-Id: I9af7a892b2dcafd30149332b0084f61d117c9cad

includes/filerepo/file/LocalFile.php

index 08c9afb..9f14669 100644 (file)
@@ -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