From: Brad Jorsch Date: Sun, 11 Jun 2017 15:21:21 +0000 (-0400) Subject: ParserCache: Delete old-style key when saving X-Git-Tag: 1.31.0-rc.0~2981 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=da43a0ae3447bd270663ef9f509c58e327d981cc;p=lhc%2Fweb%2Fwiklou.git ParserCache: Delete old-style key when saving It was noticed that disk usage on the parser cache machines was increasing since shortly after wmf.4 was redeployed everywhere on the 9th. One theory is that I7fb9ffca9 causes this by making reparses for an existing old-style cache entry start writing the new-style key where they would previously have overwritten the old-style key. On that theory, let's delete that old-style key (that should now be useless) on save. I'm assuming here that firing a blind delete for keys that probably don't exist in the cache (i.e. every new edit) isn't going to hurt anything. If that's not the case, we'd need to check existence before deleting. Bug: T167784 Change-Id: Ie5efb05722cb7da2a90da195a1f244468177175d --- diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 9c6cf93e78..1f0e19eb26 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -327,6 +327,13 @@ class ParserCache { // ...and its pointer $this->mMemc->set( $this->getOptionsKey( $page ), $optionsKey, $expire ); + // Normally, when there was no key change, the above would have + // overwritten the old entry. Delete that old entry to save disk + // space. + $oldParserOutputKey = $this->getParserOutputKey( $page, + $popts->optionsHashPre30( $optionsKey->mUsedOptions, $page->getTitle() ) ); + $this->mMemc->delete( $oldParserOutputKey ); + Hooks::run( 'ParserCacheSaveComplete', [ $this, $parserOutput, $page->getTitle(), $popts, $revId ]