Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/186630

Change subject: Never treat persistent stat cache as "latest" in FileBackend
......................................................................

Never treat persistent stat cache as "latest" in FileBackend

Change-Id: I035c0f85a641efa0e4e3209b2bcf9847c08ab0d2
---
M includes/filebackend/FileBackend.php
M includes/filebackend/FileBackendStore.php
2 files changed, 7 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/30/186630/1

diff --git a/includes/filebackend/FileBackend.php 
b/includes/filebackend/FileBackend.php
index 9504112..b87e26d 100644
--- a/includes/filebackend/FileBackend.php
+++ b/includes/filebackend/FileBackend.php
@@ -1204,7 +1204,9 @@
 
        /**
         * Preload file stat information (concurrently if possible) into 
in-process cache.
+        *
         * This should be used when stat calls will be made on a known list of 
a many files.
+        * This does not make use of the persistent file stat cache.
         *
         * @see FileBackend::getFileStat()
         *
diff --git a/includes/filebackend/FileBackendStore.php 
b/includes/filebackend/FileBackendStore.php
index a3b0009..de189ec 100644
--- a/includes/filebackend/FileBackendStore.php
+++ b/includes/filebackend/FileBackendStore.php
@@ -627,7 +627,7 @@
                }
                $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . 
"-{$this->name}" );
                $latest = !empty( $params['latest'] ); // use latest data?
-               if ( !$this->cheapCache->has( $path, 'stat', self::CACHE_TTL ) 
) {
+               if ( !$latest && !$this->cheapCache->has( $path, 'stat', 
self::CACHE_TTL ) ) {
                        $this->primeFileCache( array( $path ) ); // check 
persistent cache
                }
                if ( $this->cheapCache->has( $path, 'stat', self::CACHE_TTL ) ) 
{
@@ -1745,17 +1745,18 @@
                // Get all cache entries for these container cache keys...
                $values = $this->memCache->getMulti( array_keys( $pathNames ) );
                foreach ( $values as $cacheKey => $val ) {
+                       $path = $pathNames[$cacheKey];
                        if ( is_array( $val ) ) {
-                               $path = $pathNames[$cacheKey];
+                               $val['latest'] = false; // never completely 
trust cache
                                $this->cheapCache->set( $path, 'stat', $val );
                                if ( isset( $val['sha1'] ) ) { // some backends 
store SHA-1 as metadata
                                        $this->cheapCache->set( $path, 'sha1',
-                                               array( 'hash' => $val['sha1'], 
'latest' => $val['latest'] ) );
+                                               array( 'hash' => $val['sha1'], 
'latest' => false ) );
                                }
                                if ( isset( $val['xattr'] ) ) { // some 
backends store headers/metadata
                                        $val['xattr'] = 
self::normalizeXAttributes( $val['xattr'] );
                                        $this->cheapCache->set( $path, 'xattr',
-                                               array( 'map' => $val['xattr'], 
'latest' => $val['latest'] ) );
+                                               array( 'map' => $val['xattr'], 
'latest' => false ) );
                                }
                        }
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/186630
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I035c0f85a641efa0e4e3209b2bcf9847c08ab0d2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to