From feb7a3e10e37cb5b34268f97c6339f959eed57d9 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 26 Aug 2012 02:11:31 -0700 Subject: [PATCH] [FileBackend] Reduced stat calls when using the multiwrite backend. Change-Id: I46805637a9dcaaea597bf6eeba204a6889a36a51 --- includes/filebackend/FileBackend.php | 3 +++ includes/filebackend/FileBackendMultiWrite.php | 1 + includes/filebackend/FileBackendStore.php | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/filebackend/FileBackend.php b/includes/filebackend/FileBackend.php index 4b707fc331..daa8f22b4a 100644 --- a/includes/filebackend/FileBackend.php +++ b/includes/filebackend/FileBackend.php @@ -242,6 +242,9 @@ abstract class FileBackend { * - allowStale : Don't require the latest available data. * This can increase performance for non-critical writes. * This has no effect unless the 'force' flag is set. + * - preserveCache : Don't clear the process cache before checking files. + * This should only be used if all entries in the process + * cache were added after the files were already locked. * - nonJournaled : Don't log this operation batch in the file journal. * This limits the ability of recovery scripts. * - parallelize : Try to do operations in parallel when possible. diff --git a/includes/filebackend/FileBackendMultiWrite.php b/includes/filebackend/FileBackendMultiWrite.php index 0c8968aadf..59392f6162 100644 --- a/includes/filebackend/FileBackendMultiWrite.php +++ b/includes/filebackend/FileBackendMultiWrite.php @@ -151,6 +151,7 @@ class FileBackendMultiWrite extends FileBackend { } // Clear any cache entries (after locks acquired) $this->clearCache(); + $opts['preserveCache'] = true; // only locked files are cached // Do a consistency check to see if the backends agree $status->merge( $this->consistencyCheck( $this->fileStoragePathsForOps( $ops ) ) ); if ( !$status->isOK() ) { diff --git a/includes/filebackend/FileBackendStore.php b/includes/filebackend/FileBackendStore.php index 852a6538db..9311a90978 100644 --- a/includes/filebackend/FileBackendStore.php +++ b/includes/filebackend/FileBackendStore.php @@ -989,7 +989,9 @@ abstract class FileBackendStore extends FileBackend { } // Clear any file cache entries (after locks acquired) - $this->clearCache(); + if ( empty( $opts['preserveCache'] ) ) { + $this->clearCache(); + } // Load from the persistent file and container caches $this->primeFileCache( $performOps ); -- 2.20.1