diff --git a/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff.go b/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff.go index f3d1b51c194..b66eda2fb2f 100644 --- a/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff.go +++ b/go/cmd/vtctldclient/command/vreplication/vdiff/vdiff.go @@ -137,6 +137,7 @@ func commandVDiffCreate(cmd *cobra.Command, args []string) error { resp, err := common.GetClient().VDiffCreate(common.GetCommandCtx(), &vtctldatapb.VDiffCreateRequest{ Workflow: common.BaseOptions.Workflow, TargetKeyspace: common.BaseOptions.TargetKeyspace, + Uuid: vDiffCreateOptions.UUID.String(), SourceCells: vDiffCreateOptions.SourceCells, TargetCells: vDiffCreateOptions.TargetCells, TabletTypes: vDiffCreateOptions.TabletTypes, @@ -164,6 +165,8 @@ func commandVDiffCreate(cmd *cobra.Command, args []string) error { if err != nil { return err } + } else { + data = []byte(fmt.Sprintf("VDiff %s scheduled on target shards, use show to view progress", resp.Uuid)) } fmt.Printf("%s\n", data) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index aaabafde20c..7ae0e48702c 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -4697,6 +4697,10 @@ func (s *VtctldServer) VDiffCreate(ctx context.Context, req *vtctldatapb.VDiffCr span.Annotate("keyspace", req.TargetKeyspace) span.Annotate("workflow", req.Workflow) + span.Annotate("uuid", req.Uuid) + span.Annotate("source_cells", req.SourceCells) + span.Annotate("target_cells", req.TargetCells) + span.Annotate("tablet_types", req.TabletTypes) resp, err = s.ws.VDiffCreate(ctx, req) return resp, err diff --git a/go/vt/vtctl/workflow/server.go b/go/vt/vtctl/workflow/server.go index d6b980103cf..c9a5aac952e 100644 --- a/go/vt/vtctl/workflow/server.go +++ b/go/vt/vtctl/workflow/server.go @@ -94,9 +94,9 @@ type sequenceMetadata struct { type VDiffOutput struct { mu sync.Mutex - Request *tabletmanagerdata.VDiffRequest - Responses map[string]*tabletmanagerdata.VDiffResponse - Err error + request *tabletmanagerdata.VDiffRequest + responses map[string]*tabletmanagerdata.VDiffResponse + err error } const ( @@ -1349,11 +1349,6 @@ func (s *Server) VDiffCreate(ctx context.Context, req *vtctldatapb.VDiffCreateRe Options: options, VdiffUuid: req.Uuid, } - output := &VDiffOutput{ - Request: tabletreq, - Responses: make(map[string]*tabletmanagerdata.VDiffResponse), - Err: nil, - } ts, err := s.buildTrafficSwitcher(ctx, req.TargetKeyspace, req.Workflow) if err != nil { @@ -1364,16 +1359,13 @@ func (s *Server) VDiffCreate(ctx context.Context, req *vtctldatapb.VDiffCreateRe req.TargetKeyspace, req.Workflow) } - output.Err = ts.ForAllTargets(func(target *MigrationTarget) error { - resp, err := s.tmc.VDiff(ctx, target.GetPrimary().Tablet, tabletreq) - output.mu.Lock() - defer output.mu.Unlock() - output.Responses[target.GetShard().ShardName()] = resp + err = ts.ForAllTargets(func(target *MigrationTarget) error { + _, err := s.tmc.VDiff(ctx, target.GetPrimary().Tablet, tabletreq) return err }) - if output.Err != nil { - log.Errorf("Error executing action %s: %v", vdiff.CreateAction, output.Err) - return nil, output.Err + if err != nil { + log.Errorf("Error executing action %s: %v", vdiff.CreateAction, err) + return nil, err } return &vtctldatapb.VDiffCreateResponse{