-
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 a way to know if DemotePrimary is blocked and send it in the health stream #17289
base: main
Are you sure you want to change the base?
Conversation
…reamer Signed-off-by: Manan Gupta <manan@planetscale.com>
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
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17289 +/- ##
==========================================
- Coverage 67.40% 67.39% -0.02%
==========================================
Files 1574 1574
Lines 253205 253230 +25
==========================================
- Hits 170676 170662 -14
- Misses 82529 82568 +39 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Manan Gupta <manan@planetscale.com>
case <-time.After(10 * topo.RemoteOperationTimeout): | ||
// We waited for over 10 times of remote operation timeout, but DemotePrimary is still not done. | ||
// Collect more information and signal demote primary is indefinitely stuck. | ||
log.Errorf("DemotePrimary seems to be blocked. Collecting more information.") |
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.
log.Errorf("DemotePrimary seems to be blocked. Collecting more information.") | |
log.Errorf("DemotePrimary seems to be stalled. Collecting more information.") |
@@ -715,6 +716,10 @@ func (sm *stateManager) Broadcast() { | |||
defer sm.mu.Unlock() | |||
|
|||
lag, err := sm.refreshReplHealthLocked() | |||
if sm.demotePrimaryBlocked { | |||
// If we are blocked from demoting primary, we should send an error for it. | |||
err = vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "Demoting primary is blocked") |
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.
err = vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "Demoting primary is blocked") | |
err = vterrors.Errorf(vtrpcpb.Code_FAILED_PRECONDITION, "Failed to complete primary demotion") |
ptsTimestamp time.Time | ||
retrying bool | ||
replHealthy bool | ||
demotePrimaryBlocked bool |
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.
demotePrimaryBlocked bool | |
demotePrimaryStalled bool |
Description
This PR adds the feature requested in #17288.
We spawn a new goroutine when we start
DemotePrimary
and when enough time has passed such that DemotePrimary hasn't finished despite context cancellation, we deem it to be blocked. In this case we send an error in the health stream that the users can track and use to restart MySQL and vttablet.Related Issue(s)
DemotePrimary
is blocked #17288Checklist
Deployment Notes