-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
tsdb/wlog: Only treat unknown record types as failure #14042
base: main
Are you sure you want to change the base?
Conversation
a328f89
to
c0dc3b5
Compare
Signed-off-by: Arve Knudsen <[email protected]>
c0dc3b5
to
fb6a45f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
case record.Tombstones: | ||
|
||
default: | ||
case record.Unknown: | ||
// Could be corruption, or reading from a WAL from a newer Prometheus. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn’t grasp this comment from the initial reading, does it mean?
// Could be corruption, or reading from a WAL from a newer Prometheus. | |
// Could be corruption, or version incompatibility between the WAL and Prometheus. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep the original comment personally, since it's from before this PR. To me it's also perfectly understandable at least.
case record.Tombstones: | ||
|
||
default: | ||
case record.Unknown: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only minor downside that I can anticipate is that if we introduce a new type in the future that necessitates special handling here and we neglect to include it, recordsReadMetric (via a dashboard or an alert, if applicable) will no longer be capable of alerting us to the oversight. However, I believe we’ll eventually figure that out in another way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't see any problem with defaulting to ignore records at least, since the logic is explicitly to only handle series. It's better to not reimplement dec.Type
's logic for detecting supported record types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it some more, is it at all possible certain record types (MmapMarkers
and Metadata
, I assume that HistogramSamples
and FloatHistogramSamples
were just not added to this logic) should not be encountered here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bboreham I think you wrote this code, can you clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the code was copy-pasted from
prometheus/tsdb/wlog/watcher.go
Line 549 in 6f595c6
switch dec.Type(rec) { |
I haven't been involved in work to add histograms or metadata.
More broadly, I would like the WAL to be a bit more backwards-compatible, e.g. to have a version number so we know what we're supposed to be doing, but I couldn't see a way to add that backwards-compatibly.
I would expect the same change at prometheus/tsdb/wlog/watcher.go Lines 657 to 659 in 6f595c6
|
@bboreham thanks, I didn't notice the similarity. I can make a corresponding change there (if it makes sense, will have to think it through). |
How does this PR relate to #13181 ? |
I'll try to review that PR, wasn't known to me. |
I noticed that
tsdb/wlog.Watcher.readSegmentForGC
treats e.g. histogram records as unsupported, and counts them againstw.recordDecodeFailsMetric
. I propose that we instead do this only for therecord.Unknown
type.