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

Online DDL: timeouts for all gRPC calls #14182

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Changes from 1 commit
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
19 changes: 13 additions & 6 deletions go/vt/vttablet/onlineddl/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ const (
readyToCompleteHint = "ready_to_complete"
databasePoolSize = 3
qrBufferExtraTimeout = 5 * time.Second
grpcTimeout = 5 * time.Second
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little low. We have a default topo remote operation timeout variable that is 30s. Up to you though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upped to 30s.

vreplicationTestSuiteWaitSeconds = 5
)

Expand Down Expand Up @@ -735,9 +736,6 @@ func (e *Executor) primaryPosition(ctx context.Context) (pos replication.Positio

// terminateVReplMigration stops vreplication, then removes the _vt.vreplication entry for the given migration
func (e *Executor) terminateVReplMigration(ctx context.Context, uuid string) error {
tmClient := e.tabletManagerClient()
defer tmClient.Close()

tablet, err := e.ts.GetTablet(ctx, e.tabletAlias)
if err != nil {
return err
Expand Down Expand Up @@ -916,11 +914,13 @@ func (e *Executor) cutOverVReplMigration(ctx context.Context, s *VReplStream) er

e.toggleBufferTableFunc(bufferingCtx, onlineDDL.Table, timeout, bufferQueries)
if !bufferQueries {
grpcCtx, cancel := context.WithTimeout(ctx, grpcTimeout)
defer cancel()
// called after new table is in place.
// unbuffer existing queries:
bufferingContextCancel()
// force re-read of tables
if err := tmClient.RefreshState(ctx, tablet.Tablet); err != nil {
if err := tmClient.RefreshState(grpcCtx, tablet.Tablet); err != nil {
return err
}
}
Expand Down Expand Up @@ -3684,7 +3684,10 @@ func (e *Executor) vreplicationExec(ctx context.Context, tablet *topodatapb.Tabl
tmClient := e.tabletManagerClient()
defer tmClient.Close()

return tmClient.VReplicationExec(ctx, tablet, query)
grpcCtx, cancel := context.WithTimeout(ctx, grpcTimeout)
defer cancel()

return tmClient.VReplicationExec(grpcCtx, tablet, query)
}

// reloadSchema issues a ReloadSchema on this tablet
Expand All @@ -3696,7 +3699,11 @@ func (e *Executor) reloadSchema(ctx context.Context) error {
if err != nil {
return err
}
return tmClient.ReloadSchema(ctx, tablet.Tablet, "")

grpcCtx, cancel := context.WithTimeout(ctx, grpcTimeout)
defer cancel()

return tmClient.ReloadSchema(grpcCtx, tablet.Tablet, "")
}

// deleteVReplicationEntry cleans up a _vt.vreplication entry; this function is called as part of
Expand Down
Loading