Repository navigation
[6.x] Keep which indexes are used when the Stache is cleared - #15897
Open
DanielDarrenJones wants to merge 2 commits into
Open
DanielDarrenJones wants to merge 2 commits into
DanielDarrenJones wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stache:clear(and sostache:refresh) forgets which indexes queries have used. The warm that follows then only builds the configured indexes, and the first requests afterwards build the rest themselves, each by loading every item in the store.This keeps the list when a store is cleared, so the next warm builds the indexes the site actually queries.
On a generated site of 11,771 entries (6.42.0,
stache:clearthenstache:warm, then the first request to each page)://articlesThe warm itself took the same time and memory either way (21.4 s, 1.3 GB), as it was already building these indexes before the list had been forgotten once.
With a 256 MB memory limit those first requests fail rather than being slow.
Two things this doesn't do:
cache:clear) still loses the list.Why it was being cleared
It doesn't look like it was to fix anything. The list has been forgotten since
clear()was first written (7241012, "Driver agnostic stache clear"), along with everything else the store had cached.The line next to it, which resets the list on the store itself, came later in #3485 to fix #3476. Clearing had forgotten the cached list but left the one on the store, so the store thought the
pathindex was already recorded and never wrote it back. That showed up in asset containers, which are cleared on every request when the watcher is on.Keeping both doesn't bring that back, as the two can no longer disagree.
Found by @godismyjudge95, who measured this on a much larger site and shared the fix.