Skip to content
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

TabletManager: Check for context cancellation in loop within ChangeTabletType() #9842

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions go/vt/vttablet/tabletmanager/tm_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func (ts *tmState) ChangeTabletType(ctx context.Context, tabletType topodatapb.T
// We must read the data again and verify whether the previous write succeeded or not.
// The only way to guarantee safety is to keep retrying read until we succeed
for {
if ctx.Err() != nil {
return fmt.Errorf("context canceled updating tablet_type for %s in the topo, please retry", ts.tm.tabletAlias)
}
ti, errInReading := ts.tm.TopoServer.GetTablet(ctx, ts.tm.tabletAlias)
if errInReading != nil {
<-time.After(100 * time.Millisecond)
Expand Down