Skip to content

Commit

Permalink
Add RemoteOperationTimeout to both legacy and grpc ChangeTabletType
Browse files Browse the repository at this point in the history
… implementations

Closes #8051.

Signed-off-by: Andrew Mason <[email protected]>
  • Loading branch information
ajm188 committed May 6, 2021
1 parent 9a06a61 commit 5bd5498
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/vt/vtctl/grpcvtctldserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ func NewVtctldServer(ts *topo.Server) *VtctldServer {

// ChangeTabletType is part of the vtctlservicepb.VtctldServer interface.
func (s *VtctldServer) ChangeTabletType(ctx context.Context, req *vtctldatapb.ChangeTabletTypeRequest) (*vtctldatapb.ChangeTabletTypeResponse, error) {
ctx, cancel := context.WithTimeout(ctx, *topo.RemoteOperationTimeout)
defer cancel()

tablet, err := s.ts.GetTablet(ctx, req.TabletAlias)
if err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions go/vt/vtctl/vtctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,10 @@ func commandChangeTabletType(ctx context.Context, wr *wrangler.Wrangler, subFlag
if err != nil {
return err
}

ctx, cancel := context.WithTimeout(ctx, *topo.RemoteOperationTimeout)
defer cancel()

if *dryRun {
ti, err := wr.TopoServer().GetTablet(ctx, tabletAlias)
if err != nil {
Expand Down

0 comments on commit 5bd5498

Please sign in to comment.