Optimized doOperations() a bit to only get SH locks for the paths that aren't already...
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 21 Dec 2011 10:06:47 +0000 (10:06 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 21 Dec 2011 10:06:47 +0000 (10:06 +0000)
includes/filerepo/backend/FileBackend.php
includes/filerepo/backend/FileBackendMultiWrite.php

index 4b260e6..694e231 100644 (file)
@@ -743,6 +743,8 @@ abstract class FileBackend extends FileBackendBase {
                                $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
                                $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
                        }
+                       // Optimization: if doing an EX lock anyway, don't also set an SH one
+                       $filesLockSh = array_diff( $filesLockSh, $filesLockEx );
                        // Try to lock those files for the scope of this function...
                        $scopeLockS = $this->getScopedFileLocks( $filesLockSh, LockManager::LOCK_UW, $status );
                        $scopeLockE = $this->getScopedFileLocks( $filesLockEx, LockManager::LOCK_EX, $status );
index e361ed2..c73dcca 100644 (file)
@@ -82,6 +82,8 @@ class FileBackendMultiWrite extends FileBackendBase {
                                        $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
                                        $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
                                }
+                               // Optimization: if doing an EX lock anyway, don't also set an SH one
+                               $filesLockSh = array_diff( $filesLockSh, $filesLockEx );
                                // Lock the paths under the proxy backend's name
                                $this->unsubstPaths( $filesLockSh );
                                $this->unsubstPaths( $filesLockEx );