r106935 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106934‎ | r106935 | r106936 >
Date:10:06, 21 December 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Optimized doOperations() a bit to only get SH locks for the paths that aren't already going to get EX locks
Modified paths:
  • /trunk/phase3/includes/filerepo/backend/FileBackend.php (modified) (history)
  • /trunk/phase3/includes/filerepo/backend/FileBackendMultiWrite.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/backend/FileBackendMultiWrite.php
@@ -82,6 +82,8 @@
8383 $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
8484 $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
8585 }
 86+ // Optimization: if doing an EX lock anyway, don't also set an SH one
 87+ $filesLockSh = array_diff( $filesLockSh, $filesLockEx );
8688 // Lock the paths under the proxy backend's name
8789 $this->unsubstPaths( $filesLockSh );
8890 $this->unsubstPaths( $filesLockEx );
Index: trunk/phase3/includes/filerepo/backend/FileBackend.php
@@ -743,6 +743,8 @@
744744 $filesLockSh = array_merge( $filesLockSh, $fileOp->storagePathsRead() );
745745 $filesLockEx = array_merge( $filesLockEx, $fileOp->storagePathsChanged() );
746746 }
 747+ // Optimization: if doing an EX lock anyway, don't also set an SH one
 748+ $filesLockSh = array_diff( $filesLockSh, $filesLockEx );
747749 // Try to lock those files for the scope of this function...
748750 $scopeLockS = $this->getScopedFileLocks( $filesLockSh, LockManager::LOCK_UW, $status );
749751 $scopeLockE = $this->getScopedFileLocks( $filesLockEx, LockManager::LOCK_EX, $status );

Comments

#Comment by Aaron Schulz (talk | contribs)   23:59, 21 December 2011

This also fixed bug 33294. I think it should ring a few bells :)

Status & tagging log