Draft: Improve cache consistency for incremental ref updates
What does this MR do and why?
Improve cache consistency for incremental ref updates
Contributes to #580122 (closed)
This change addresses potential cache inconsistencies when using granular branch/tag cache updates by:
-
Moving cache updates from async worker to synchronous git hook
- Updates happen in PostReceiveService before job scheduling
- Eliminates out-of-order execution issues from async jobs
- Ensures cache reflects reality before dependent operations
-
Adding cache validation and self-healing in PostReceiveWorker
- New RefCacheValidator class validates cache against Gitaly
- Automatically heals inconsistencies when detected
- Provides observability through structured logging
-
Simplifying PostReceiveWorker logic
- Removes granular update logic (now in git hook)
- Worker only validates and heals if needed
The synchronous update ensures immediate consistency, while async validation provides a safety net to detect and fix any race conditions in multi-server environments.
References
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.
Related to #580122 (closed)