Skip to content

Commit 6b81ee5

Browse files
Allow stop/start on specific shards
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
1 parent eaaa206 commit 6b81ee5

File tree

7 files changed

+390
-278
lines changed

7 files changed

+390
-278
lines changed

go/cmd/vtctldclient/command/vreplication/workflow/state.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ func commandUpdateState(cmd *cobra.Command, args []string) error {
6060
cli.FinishedParsing(cmd)
6161

6262
var state binlogdatapb.VReplicationWorkflowState
63+
var shards []string
6364
switch strings.ToLower(cmd.Name()) {
6465
case "start":
6566
if err := common.CanRestartWorkflow(baseOptions.Keyspace, baseOptions.Workflow); err != nil {
6667
return err
6768
}
6869
state = binlogdatapb.VReplicationWorkflowState_Running
70+
shards = baseOptions.Shards
6971
case "stop":
7072
state = binlogdatapb.VReplicationWorkflowState_Stopped
73+
shards = baseOptions.Shards
7174
default:
7275
return fmt.Errorf("invalid workflow state: %s", args[0])
7376
}
@@ -80,6 +83,7 @@ func commandUpdateState(cmd *cobra.Command, args []string) error {
8083
Cells: textutil.SimulatedNullStringSlice,
8184
TabletTypes: textutil.SimulatedNullTabletTypeSlice,
8285
State: &state,
86+
Shards: shards,
8387
},
8488
}
8589

go/vt/proto/tabletmanagerdata/tabletmanagerdata.pb.go

Lines changed: 286 additions & 277 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/vt/proto/tabletmanagerdata/tabletmanagerdata_vtproto.pb.go

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/vt/vtctl/workflow/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,8 +1607,10 @@ func (s *Server) WorkflowUpdate(ctx context.Context, req *vtctldatapb.WorkflowUp
16071607
span.Annotate("on_ddl", req.TabletRequest.OnDdl)
16081608
span.Annotate("state", req.TabletRequest.State)
16091609
span.Annotate("config_overrides", req.TabletRequest.ConfigOverrides)
1610+
span.Annotate("shards", req.TabletRequest.Shards)
16101611

16111612
vx := vexec.NewVExec(req.Keyspace, req.TabletRequest.Workflow, s.ts, s.tmc, s.env.Parser())
1613+
vx.SetShardSubset(req.TabletRequest.Shards)
16121614
callback := func(ctx context.Context, tablet *topo.TabletInfo) (*querypb.QueryResult, error) {
16131615
res, err := s.tmc.UpdateVReplicationWorkflow(ctx, tablet.Tablet, req.TabletRequest)
16141616
if err != nil {

proto/tabletmanagerdata.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ message UpdateVReplicationWorkflowRequest {
781781
optional TabletSelectionPreference tablet_selection_preference = 4;
782782
optional binlogdata.OnDDLAction on_ddl = 5;
783783
optional binlogdata.VReplicationWorkflowState state = 6;
784-
reserved 7; // unused, was: repeated string shards
784+
repeated string shards = 7;
785785
map<string, string> config_overrides = 8;
786786
}
787787

web/vtadmin/src/proto/vtadmin.d.ts

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/vtadmin/src/proto/vtadmin.js

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)