Optimize consistencyCheck() in FileBackendMultiwrite
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 26 Apr 2016 22:09:28 +0000 (15:09 -0700)
committerOri.livneh <ori@wikimedia.org>
Wed, 27 Apr 2016 05:18:25 +0000 (05:18 +0000)
doOperationsInternal() already set "preserveCache" but never actually
filled it in to begin with. This should lower round trips if sync checks
are enabled.

Change-Id: Ica67b8d66e7602faed842408365edbd466688f61

includes/filebackend/FileBackendMultiWrite.php

index 0d7bf66..c432025 100644 (file)
@@ -241,6 +241,12 @@ class FileBackendMultiWrite extends FileBackend {
                        return $status; // skip checks
                }
 
+               // Preload all of the stat info in as few round trips as possible...
+               foreach ( $this->backends as $backend ) {
+                       $realPaths = $this->substPaths( $paths, $backend );
+                       $backend->preloadFileStat( [ 'srcs' => $realPaths, 'latest' => true ] );
+               }
+
                $mBackend = $this->backends[$this->masterIndex];
                foreach ( $paths as $path ) {
                        $params = [ 'src' => $path, 'latest' => true ];