tsdb: Track stale series in the Head block based on stale sample#16925
Merged
tsdb: Track stale series in the Head block based on stale sample#16925
Conversation
This was referenced Jul 25, 2025
fd57aea to
42ce9d8
Compare
SuperQ
approved these changes
Aug 12, 2025
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
42ce9d8 to
3904b3c
Compare
SuperQ
added a commit
that referenced
this pull request
Aug 26, 2025
Add changelog entry to pull in #16925 to v3.6.0. Signed-off-by: SuperQ <superq@gmail.com>
SuperQ
added a commit
that referenced
this pull request
Aug 26, 2025
Add changelog entry to pull in #16925 to v3.6.0. Signed-off-by: SuperQ <superq@gmail.com>
codesome
added a commit
that referenced
this pull request
Jan 24, 2026
…ction tsdb: Early compaction of stale series Closes #13616 Based on prometheus/proposals#55 Stale series tracking was added in #16925. This PR compacts the stale series into its own block before the normal compaction hits. Here is how the settings: stale_series_compaction_threshold: As soon as the ratio of stale series in the head block crosses StaleSeriesImmediateCompactionThreshold, TSDB performs a stale series compaction and puts all the stale series into a block and removed it from the head, but it does not remove it from the WAL. (technically this condition is checked every minute and not exactly immediate) Additional details WAL replay: after a stale series compaction, tombstones are added with (MinInt64, MaxInt64) for all these stale series. During WAL replay we add a special condition where when we find such tombstone, it immediately removes the series from the memory instead of storing the tombstone. This is required so that we don't spike up memory during WAL replay and also don't keep the compacted stale series in the memory. Head block truncation ignores this block via the added metadata, similar to out-of-order blocks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #13616 and prometheus/proposals#55. But irrespective of what we do for compaction of stale series, it will be good to have tracking of how many stale series we have in the Head block