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.
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
Fix race in
replicationLagModule
ofgo/vt/throttle
#16078Fix race in
replicationLagModule
ofgo/vt/throttle
#16078Changes from 2 commits
f53e089
1b49ce7
49e2dc7
e556e2f
df59fcf
1da308b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Moved this mostly-unchanged from
throttler.go
(.MaxLag(...)
) instead of holding themu sync.Mutex
lock from a different struct.MaxLag()
now calls thisfunc
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.
Moved into
replicationLagCache
Check failure on line 419 in go/vt/throttler/throttler_test.go
GitHub Actions / Static Code Checks Etc
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.
This looks like a busy loop. potentially running thousands of time in the span of
1sec
. Is this intentional? I'm thinking there should be a ticker to introduce some forced delay.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.
@shlomi-noach yes, these busy loops were used to reproduce the race in unit tests, before I fixed the race
Check failure on line 440 in go/vt/throttler/throttler_test.go
GitHub Actions / Static Code Checks Etc
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.
This looks like a busy loop. Is this intentional? For the duration of
1sec
this loop could run potentially thousands of time as there is no sleep. Is there an objective to this?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.
@shlomi-noach yes, the intent here was to call
.MaxLag()
as frequently as possible, because the race needs decent concurrency to occurCheck failure on line 450 in go/vt/throttler/throttler_test.go
GitHub Actions / Static Code Checks Etc
Check failure on line 470 in go/vt/throttler/throttler_test.go
GitHub Actions / Static Code Checks Etc