From 5bd549829f3122c5df4a96558586d0fd49221ad4 Mon Sep 17 00:00:00 2001 From: Andrew Mason Date: Wed, 5 May 2021 23:01:34 -0400 Subject: [PATCH] Add RemoteOperationTimeout to both legacy and grpc `ChangeTabletType` implementations Closes #8051. Signed-off-by: Andrew Mason --- go/vt/vtctl/grpcvtctldserver/server.go | 3 +++ go/vt/vtctl/vtctl.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index 7bbf73d4c1b..66a8cc93053 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -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 diff --git a/go/vt/vtctl/vtctl.go b/go/vt/vtctl/vtctl.go index c475e53d163..802eba81058 100644 --- a/go/vt/vtctl/vtctl.go +++ b/go/vt/vtctl/vtctl.go @@ -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 {