Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(dev/core#3166) "Metadata" cache - Strictly separate by version (5.48) #23167

Merged
merged 1 commit into from
Apr 11, 2022

Conversation

totten
Copy link
Member

@totten totten commented Apr 11, 2022

Overview

This addresses some symptoms identified in the discussion of dev/core#3166 where a recently-updated codebase generates errors due to stale cache data.

With this patch, the metadata cache will be de-facto reset whenever you load new code.

Backport of #23148 from 5.49-rc to 5.48-stable.

This addresses some symptoms identified in the discussion of 3166.

Before
------

The "metadata" cache is always stored with the name `metadata`.

If you load a newer codebase, it still reads `metadata` from the older code base (until something explicitly clears the cache).

After
-----

The "metadata" cache is always stored with the name `metadata_{version}`, eg `metadata_5_48_0`.

If you load a newer codebase (eg `5.49.0`), it will ignore the older `metadata_5_48_0` and create a new `metadata_5_49_0`.

Comments
--------

The upgrade system also clears cache, but many users rely on navigating through the site to get to the upgrader.

The change could make sense with other caches, but I only applied the change to the `metadata` cache because there is _some_ risk;
eg if some caller bypasses the cache objects. (I was also slightly concerned about the possibility the some caller relies
on `$cache->getName()` or `$cache->getPrefix()` or similar... but I haven't been able to find any methods like that...). It seems
safer to put that sort of change into a monthly update rather than minor patch.
@civibot
Copy link

civibot bot commented Apr 11, 2022

(Standard links)

@civibot civibot bot added the 5.48 label Apr 11, 2022
@totten totten changed the title (dev/core#3166) "Metadata" cache - Strictly separate by version (dev/core#3166) "Metadata" cache - Strictly separate by version (5.48) Apr 11, 2022
@colemanw colemanw merged commit 6b908db into civicrm:5.48 Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants