Repository navigation
Keep metric writes reachable during concurrent retention - #588
robertexternbrink wants to merge 2 commits into
Conversation
BUG-cc-backend-T8103-F-e3fd58179aba-001
spacehamster87
left a comment
There was a problem hiding this comment.
I used AI-Assist to understand the change better. The change itself looks solid and worth merging. The review flagged three uncritical points:
- Leftover lookup in
DecodeLine. It still callsms.GetLevel(st.selector)[lineprotocol.go:312]. That call can create a level, and its result is no longer used for writing; lvl only serves as a "cluster or host changed" flag now. The call and the variable could go, keeping prevCluster/prevHost. - Stale comment at
[level.go:207-211]. It should say that the guarantee now comes from WriteToLevel holding the ancestor locks. findLevelOrCreatestill exists and keeps the early-release behaviour. It's still called from GetLevel, checkpoint loading [checkpoint.go:433] and WAL replay [walCheckpoint.go:627]. WAL replay even caches level pointers: Fine if both only run at startup before retention starts.
|
Thanks for the review, @spacehamster87. I removed the redundant I checked the restore call sites as well. In production, checkpoint restore and WAL replay run during startup.
|
Keep ancestor levels locked until the leaf write completes and resolve ingestion writes from the root. Concurrent retention can otherwise detach a newly created level and lose successfully accepted samples.
Validation: Retention/write and ingestion regressions plus the metricstore package passed locally, including race checks.