-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
WAL Checkpoint holds deleted series for 1 extra compaction cycle #12286
Comments
I tried to write out step-by-step what happens to cause this. Consider a series
At approx 13:00, head compaction runs. A block is created from 10-12, and A WAL checkpoint is created from the first two thirds of the segments, A-D.
After two more hours, the head and WAL have built up:
At approx 15:00, head compaction runs again.
After two more hours, the head and WAL have built up:
At approx 17:00, head compaction runs again.
Only at the next head compaction at 19:00 will series In this way, a series which stopped receiving data at 10:45 is retained in the WAL until 19:00. |
This is a nice find. We probably have to dive in to see why is this happening. Just want to leave a comment here saying that whatever is affecting the WAL is probably affecting the WBL too since they both rely on the same implementation with minor differences. |
Thanks @jesusvazquez : I don't see anything about a checkpoint in the WBL code I looked at: Lines 1247 to 1261 in 5442d7e
Is there some other mechanism to ensure there is a series record for all samples in the remaining part of the WBL? BTW it would be nice to have the WBL mentioned in the docs https://github.com/prometheus/prometheus/blob/a0f7c31c2666dc45f8006ee66395b5409a59a2b9/tsdb/docs/ |
Following up my last comment: it turns out every sample in the WBL is first written to the WAL, so the series records in the WAL will work for the WBL too. Now that #12297 is merged, the problem is reduced: we are holding series for 1 extra compaction cycle. |
EDIT: the problem has been substantially improved by #12297; check out the write-up there for details.
What did you do?
I observed a Prometheus where
prometheus_tsdb_head_series
varied from 4 million to 7 million over each compaction cycle.The number of series in the WAL checkpoint is not observable via a metric, so I downloaded it and used the following code, adapted from
TestReadCheckpointMultipleSegments
to see the number of series:What did you expect to see?
About 7 million series in the WAL checkpoint (same as the max observed number of series).
Reasoning: a WAL checkpoint is generated every head compaction* (= 2 hours with default settings) and the checkpoint covers about the same time, so the checkpoint should have about the same number of series as I observe in the head.
* unless the amount of data being collected is small, in which case it's every 2 head compactions.
What did you see instead? Under which circumstances?
The WAL checkpoint had 18 million series in it.
Prometheus version
The text was updated successfully, but these errors were encountered: