Skip to content

Commit

Permalink
Merge pull request #8052 from tinyspeck/am_change_tablet_type_remote_…
Browse files Browse the repository at this point in the history
…timeout

Add RemoteOperationTimeout to both legacy and grpc `ChangeTabletType` implementations.
  • Loading branch information
rafael authored May 7, 2021
2 parents 01148a0 + 5bd5498 commit 0a5e76b
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 0a5e76b

Please sign in to comment.