Fix incompatible Rails cache version from 7.1 to 6.1
What does this MR do and why?
GitLab 18.0 is shipped with new Rails cache format_version of 7.1. When GitLab 18.0 is downgraded to 17.11, the new cache entries can't be read by the previous coder (Rails61Coder) and caused crash/exceptions during initialization.
This change adds a custom coder based on Rails61Coder that supports recognizing the magic bytes from 7.1, then treat it as a cache miss so that the value gets rewritten in the 6.1 version and readable afterwards.
The changes here don't affect anything on GitLab 18.0 onwards, but have to be merged first as part of backport process.
The fix here is only intended to target GitLab 17.11.
Reference for different GitLab vs Rails vs cache_format_versions versions:
| GitLab version | Rails version |
cache_format_version set by GitLab |
|---|---|---|
| 17.11 | 7.0.8.7 |
nil -> default to 6.1 |
| 18.0 | 7.1.5.1 | 7.1 |
| 18.1 | 7.1.5.1 | 7.1 |
References
- #552652 (closed)
- Spawned from !195052 (comment 2579713887) and !195445 (merged)
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.