Repository navigation
Conversation
r0h1tb
requested review from
a team,
bwplotka,
codesome,
jesusvazquez and
krajorama
as code owners
November 21, 2026 13:11
A float staleness marker that is the first sample of a native histogram series in an append was dropped when the same append had a later sample of that series. commitFloats converts the marker to a histogram marker and commits it after the batch's histograms, which is only correct if no other sample of the series is in the batch. Since floats are not tracked in typesInBatch, the later sample stayed in the batch, so the marker was committed after it and rejected as out of order, while Commit returned nil and the WAL still held it. Track such a marker as stStaleFloat, so any later sample of the series starts a new batch. Signed-off-by: Rohit Behera <[email protected]>
r0h1tb
force-pushed
the
fix/tsdb-stale-marker-before-histogram
branch
from
November 22, 2026 10:34
9e20420 to
8600b74
Compare
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.
Which issue(s) does the PR fix:
No issue filed. Regression from #17296 (v3.7.0).
If the first sample of a native histogram series in an append is a float staleness marker, and the same append has a later sample for that series,
Commit()returns nil but the marker is not stored:commitFloatsturns the marker into a histogram marker and appends it after the batch's histograms. Its comment relies on there being no other sample of that series in the batch, but since #17296 floats are not tracked intypesInBatch, so the histogram at 300 stays in the same batch. The marker is then committed after it, rejected as out of order and dropped. It is still in the WAL, so the head and a replay disagree, andprometheus_tsdb_out_of_order_samples_totalgoes up. A float at 300 instead of a histogram goes wrong the same way.This is what a remote-write receiver gets when a series goes stale and comes back within one request: the sender writes histogram staleness markers to its WAL as float
StaleNaN(seestorage/remote/queue_manager.go), and the receiver answers 204 and loses the marker. Scrapes append one sample per series per commit and are not affected.The fix records a float staleness marker in
typesInBatchasstStaleFloatwhen its series has no type in the batch yet, so any later sample of that series starts a new batch. Plain floats stay untracked.TestHead_StaleMarkerBeforeLaterSampleInSameCommitcovers integer and float histograms, appender V1 and V2, and a histogram or a float after the marker, checking the head before and after WAL replay. All 8 cases fail on main with[100 300]instead of[100 200 300]. I also checked it throughNewWriteHandlerwith two v1 write requests against a real TSDB: 2 of 3 samples stored before, 3 of 3 after.Release notes for end users (ALL commits must be considered).
Reviewers should verify clarity and quality.