jenkins-bot has submitted this change and it was merged. Change subject: More rigorous clearing of image redirect cache ......................................................................
More rigorous clearing of image redirect cache Instead of deleting the cache key, set a temporary value, so that the key stays "deleted" long enough so that replag won't cause the key to be repopulated with an incorrect value from a slave db. Bug: 52200 Change-Id: I0941c93b76fb0aa8eedb883a3ed1167c6e14d0c0 --- M includes/filerepo/LocalRepo.php M includes/specials/SpecialMovepage.php 2 files changed, 9 insertions(+), 12 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/filerepo/LocalRepo.php b/includes/filerepo/LocalRepo.php index 549be40..9b62243 100644 --- a/includes/filerepo/LocalRepo.php +++ b/includes/filerepo/LocalRepo.php @@ -171,13 +171,13 @@ if ( $cachedValue === ' ' || $cachedValue === '' ) { // Does not exist return false; - } elseif ( strval( $cachedValue ) !== '' ) { + } elseif ( strval( $cachedValue ) !== '' && $cachedValue !== ' PURGED' ) { return Title::newFromText( $cachedValue, NS_FILE ); } // else $cachedValue is false or null: cache miss $id = $this->getArticleID( $title ); if ( !$id ) { - $wgMemc->set( $memcKey, " ", $expiry ); + $wgMemc->add( $memcKey, " ", $expiry ); return false; } $dbr = $this->getSlaveDB(); @@ -190,10 +190,10 @@ if ( $row && $row->rd_namespace == NS_FILE ) { $targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title ); - $wgMemc->set( $memcKey, $targetTitle->getDBkey(), $expiry ); + $wgMemc->add( $memcKey, $targetTitle->getDBkey(), $expiry ); return $targetTitle; } else { - $wgMemc->set( $memcKey, '', $expiry ); + $wgMemc->add( $memcKey, '', $expiry ); return false; } } @@ -347,7 +347,11 @@ global $wgMemc; $memcKey = $this->getSharedCacheKey( 'image_redirect', md5( $title->getDBkey() ) ); if ( $memcKey ) { - $wgMemc->delete( $memcKey ); + // Set a temporary value for the cache key, to ensure + // that this value stays purged long enough so that + // it isn't refreshed with a stale value due to a + // lagged slave. + $wgMemc->set( $memcKey, ' PURGED', 12 ); } } } diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 0e342cc..1dc4244 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -692,13 +692,6 @@ # Deal with watches (we don't watch subpages) WatchAction::doWatchOrUnwatch( $this->watch, $ot, $user ); WatchAction::doWatchOrUnwatch( $this->watch, $nt, $user ); - - # Re-clear the file redirect cache, which may have been polluted by - # parsing in messages above. See CR r56745. - # @todo FIXME: Needs a more robust solution inside FileRepo. - if ( $ot->getNamespace() == NS_FILE ) { - RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $ot ); - } } function showLogFragment( $title ) { -- To view, visit https://gerrit.wikimedia.org/r/77562 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0941c93b76fb0aa8eedb883a3ed1167c6e14d0c0 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Brian Wolff <bawolff...@gmail.com> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: Greg Grossmeier <g...@wikimedia.org> Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits