Skip to content

Commit

Permalink
Allow stop/start on specific shards
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps committed Jan 20, 2025
1 parent eaaa206 commit 6b81ee5
Show file tree
Hide file tree
Showing 7 changed files with 390 additions and 278 deletions.
4 changes: 4 additions & 0 deletions go/cmd/vtctldclient/command/vreplication/workflow/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,17 @@ func commandUpdateState(cmd *cobra.Command, args []string) error {
cli.FinishedParsing(cmd)

var state binlogdatapb.VReplicationWorkflowState
var shards []string
switch strings.ToLower(cmd.Name()) {
case "start":
if err := common.CanRestartWorkflow(baseOptions.Keyspace, baseOptions.Workflow); err != nil {
return err
}
state = binlogdatapb.VReplicationWorkflowState_Running
shards = baseOptions.Shards
case "stop":
state = binlogdatapb.VReplicationWorkflowState_Stopped
shards = baseOptions.Shards
default:
return fmt.Errorf("invalid workflow state: %s", args[0])
}
Expand All @@ -80,6 +83,7 @@ func commandUpdateState(cmd *cobra.Command, args []string) error {
Cells: textutil.SimulatedNullStringSlice,
TabletTypes: textutil.SimulatedNullTabletTypeSlice,
State: &state,
Shards: shards,
},
}

Expand Down
563 changes: 286 additions & 277 deletions go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1607,8 +1607,10 @@ func (s *Server) WorkflowUpdate(ctx context.Context, req *vtctldatapb.WorkflowUp
span.Annotate("on_ddl", req.TabletRequest.OnDdl)
span.Annotate("state", req.TabletRequest.State)
span.Annotate("config_overrides", req.TabletRequest.ConfigOverrides)
span.Annotate("shards", req.TabletRequest.Shards)

vx := vexec.NewVExec(req.Keyspace, req.TabletRequest.Workflow, s.ts, s.tmc, s.env.Parser())
vx.SetShardSubset(req.TabletRequest.Shards)
callback := func(ctx context.Context, tablet *topo.TabletInfo) (*querypb.QueryResult, error) {
res, err := s.tmc.UpdateVReplicationWorkflow(ctx, tablet.Tablet, req.TabletRequest)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion proto/tabletmanagerdata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ message UpdateVReplicationWorkflowRequest {
optional TabletSelectionPreference tablet_selection_preference = 4;
optional binlogdata.OnDDLAction on_ddl = 5;
optional binlogdata.VReplicationWorkflowState state = 6;
reserved 7; // unused, was: repeated string shards
repeated string shards = 7;
map<string, string> config_overrides = 8;
}

Expand Down
6 changes: 6 additions & 0 deletions web/vtadmin/src/proto/vtadmin.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions web/vtadmin/src/proto/vtadmin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6b81ee5

Please sign in to comment.