-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add infinite buffer to health check consumers #17632
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
…that causes panics Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Signed-off-by: Manan Gupta <[email protected]>
4a46293
to
9e0a835
Compare
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17632 +/- ##
==========================================
+ Coverage 67.64% 67.67% +0.03%
==========================================
Files 1586 1587 +1
Lines 255629 255732 +103
==========================================
+ Hits 172910 173078 +168
+ Misses 82719 82654 -65 ☔ View full report in Codecov by Sentry. |
go/vt/discovery/healthcheck.go
Outdated
// Keep receiving updates on the message queue. | ||
th, validRes := mq.Receive() | ||
if validRes { | ||
c <- th |
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 will block if channel is full, correct?
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.
Let us add a metric that exports the size of this queue.
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.
Okay 👍
totalCount := 0 | ||
go func() { | ||
for range ch { | ||
totalCount++ |
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.
you need to put this access and the other one behind a mutex, otherwise race test fails.
No back ports of this PR, please. Instead we can do #17634 on old release branches. |
Signed-off-by: Manan Gupta <[email protected]>
Signed-off-by: Manan Gupta <[email protected]>
Description
This PR fixes the problem described in #17629. As pointed out in the issue, the problem is that the consumers aren't fast enough to ingest all the health check updates and that causes them to miss some of them.
To prevent this, this PR adds a new message queue which keeps track of messages with an infinite capacity (we'll OOM eventually), while continuing to support the same semantics from the client side. The message queue has been added in a higher level package so that it can shared across the codebase if the use case for it arrises in the future.
Related Issue(s)
Checklist
Deployment Notes