Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/212242
Change subject: Fixed race condition in MessageCache::replace ...................................................................... Fixed race condition in MessageCache::replace Change-Id: I98ff158a1575330bc59efe6badb27f8de8717951 --- M includes/cache/MessageCache.php 1 file changed, 5 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/42/212242/1 diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 31ee487..1c7d918 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -236,10 +236,11 @@ * is disabled. * * @param bool|string $code Language to which load messages + * @param string $mode Use 'forupdate' to skip process cache * @throws MWException * @return bool */ - function load( $code = false ) { + function load( $code = false, $mode = null ) { global $wgUseLocalMessageCache; if ( !is_string( $code ) ) { @@ -250,7 +251,7 @@ } # Don't do double loading... - if ( isset( $this->mLoadedLanguages[$code] ) ) { + if ( isset( $this->mLoadedLanguages[$code] ) && $mode !== 'forupdate' ) { return true; } @@ -275,7 +276,6 @@ # Hash of the contents is stored in memcache, to detect if local cache goes # out of date (e.g. due to replace() on some other server) if ( $wgUseLocalMessageCache ) { - $hash = $this->mMemc->get( wfMemcKey( 'messages', $code, 'hash' ) ); if ( $hash ) { $cache = $this->getLocalCache( $hash, $code ); @@ -514,18 +514,17 @@ * @param mixed $text New contents of the page. */ public function replace( $title, $text ) { - global $wgMaxMsgCacheEntrySize; + global $wgMaxMsgCacheEntrySize, $wgContLang; if ( $this->mDisable ) { - return; } list( $msg, $code ) = $this->figureMessage( $title ); $cacheKey = wfMemcKey( 'messages', $code ); - $this->load( $code ); $this->lock( $cacheKey ); + $this->load( $code, 'forupdate' ); $titleKey = wfMemcKey( 'messages', 'individual', $title ); @@ -561,7 +560,6 @@ } // Update the message in the message blob store - global $wgContLang; $blobStore = new MessageBlobStore(); $blobStore->updateMessage( $wgContLang->lcfirst( $msg ) ); -- To view, visit https://gerrit.wikimedia.org/r/212242 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I98ff158a1575330bc59efe6badb27f8de8717951 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits