-
Notifications
You must be signed in to change notification settings - Fork 10.3k
fix bug that would cause us to endlessly fall behind #13583
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
92ed2eb
fix bug that would cause us to only read from the WAL on the 15s
cstyan 7dfffcd
remove unintended logging, fix lint, plus allow test to take slightly
cstyan df15f0c
address review feedback
cstyan 6bcb4bc
fix watcher sleeps in test, flu brain is smooth
cstyan 9e8de14
increase timeout, unfortunately cloud CI can require a longer timeout
cstyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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 don't know if this was intentional (I cannot see it explicitly stated)
But I think that in order to help the watcher catch up, we started making it skip samples records now (
tail=falsehere passed toreadSegmentmakes it skip/ignore the samples records)When this issue was discussed, the
case <-segmentTicker.Cblockprometheus/tsdb/wlog/watcher.go
Lines 451 to 461 in 8849b7d
segmentCheckPeriod = 100 * time.Millisecondwhich should be sufficient.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 added a check that shows the samples being dropped here #14434
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 propose that the reason for the bug is that
tailmeans several things in the code.I will try a PR where the meanings are broken out into separate parameters.
Uh oh!
There was an error while loading. Please reload this page.
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.
Yep,I think a
seriesRecordsOnlyas a param toreadSegmentmakes more sense, or makereadSegmentreads everything and have areadSegmentToBuildSeriesor sth to only build series.I have a local branch with some cleaning regarding that, I was planning to push with the fix into #14434, but, please, be my guest.
Regarding the bug fix, I suggest we only revert #13583 and re-open #13471 to learn more about the real issue.
Strangely
TestRun_AvoidNotifyWhenBehindstill passes after the revert, locally.I think running that operation every
segmentCheckPeriod = 100 * time.Millisecondis acceptable.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'm not sure I agree that just the new segment check via the ticker, without some additional changes in other places, is enough. This line would have had to change to be something like:
But then we introduce yet another way to lose samples.
I agree with @bboreham that the overloading of the meaning of
tailis the problem. We still want to check for segments on some interval, read from the currently written to segment only when we're notified that it's been written to (or on some timer just in case write events are lost within RW somewhere), be notified of checkpoints, etc.I think we could skip the select statement within
watchcompletely ifwatchis not currently reading the segment that is being written to, we really want to just read and send the samples fromcurrentSegmentas fast as possible in that case (based on the available resources and queue config).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 don’t have any stats/data to back my statements, I was just suggesting that unless we have proof (I don't think #13471 provided any) that setting
segmentCheckPeriod = 100 * time.Millisecondcould be problematic (reduces read throughput) in certain setups, reverting to the old behavior is the safest/simplest solution.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.
Hi, sorry I didn't follow this conversation and pushed my own ideas at #14439
I think it would be ok as a backport for v2.52 to revert and fix just the bit that is wrong.