Use the redis set cache for branch and tag names
What does this MR do?
This completes the re-introduction of gitlab-foss!30476 (merged), which was reverted in gitlab-foss!32408 (merged) and partially reintroduced in gitlab-foss!32412 (merged)
The revert was because the code didn't handle a HA environment with mixed code well - incorrect cache invalidation meant that sometimes branches or tags would seem to be missing.
To resolve this, we introduced an abstract "redis set cache" into %12.3 and started sending cache-invalidation messages to it. This means that in %12.4, we can start using that cache for branch names and tag names.
On git push
, or any other event that changes the list of branches and tags, 12.3 will invalidate both the old Rails.cache
-based cache, and the new redis set cache
, and so will 12.4. 12.2 only invalidated the former.
On read, 12.3 will only read from the former; 12.4 will only read from the latter.
In a mixed-code environment, we'll hold the values in Redis twice, but each will always be correct. Once the mixed-code environment is fully upgraded to 12.4, the duplicate copies will go away.
Using a redis set allows us to check whether a branch exists using the SISMEMBER
Redis command, instead of reading the full
list of branches from Redis then doing an array membership check. This is a big improvement in some circumstances.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation created/updated or follow-up review issue created
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Closes #30439 (closed)