From: Aaron Schulz Date: Wed, 21 Dec 2011 10:06:47 +0000 (+0000) Subject: Optimized doOperations() a bit to only get SH locks for the paths that aren't already... X-Git-Tag: 1.31.0-rc.0~25835 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles_versions%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=a0e5c46d5f0e5d9cdb920a6cfdbeaf68cc24df94;p=lhc%2Fweb%2Fwiklou.git Optimized doOperations() a bit to only get SH locks for the paths that aren't already going to get EX locks --- diff --git a/includes/filerepo/backend/FileBackend.php b/includes/filerepo/backend/FileBackend.php index 4b260e6d33..694e231e91 100644 --- a/includes/filerepo/backend/FileBackend.php +++ b/includes/filerepo/backend/FileBackend.php @@ -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 ); diff --git a/includes/filerepo/backend/FileBackendMultiWrite.php b/includes/filerepo/backend/FileBackendMultiWrite.php index e361ed22c5..c73dcca454 100644 --- a/includes/filerepo/backend/FileBackendMultiWrite.php +++ b/includes/filerepo/backend/FileBackendMultiWrite.php @@ -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 );