diff --git a/go/vt/vtctl/workflow/traffic_switcher.go b/go/vt/vtctl/workflow/traffic_switcher.go index 4fc34992b0f..1732f3425b7 100644 --- a/go/vt/vtctl/workflow/traffic_switcher.go +++ b/go/vt/vtctl/workflow/traffic_switcher.go @@ -1148,8 +1148,11 @@ func (ts *trafficSwitcher) cancelMigration(ctx context.Context, sm *StreamMigrat // We create a new context while canceling the migration, so that we are independent of the original // context being cancelled prior to or during the cancel operation. + // Create a child context that cannot be canceled by the parent, so that we maintain the locks. + cctx := context.WithoutCancel(ctx) + // Now create a child context from that which has a timeout. cmTimeout := 60 * time.Second - cmCtx, cmCancel := context.WithTimeout(context.Background(), cmTimeout) + cmCtx, cmCancel := context.WithTimeout(cctx, cmTimeout) defer cmCancel() if ts.MigrationType() == binlogdatapb.MigrationType_TABLES { diff --git a/go/vt/vtctl/workflow/workflows.go b/go/vt/vtctl/workflow/workflows.go index f5dcc29ed1d..99739d3556b 100644 --- a/go/vt/vtctl/workflow/workflows.go +++ b/go/vt/vtctl/workflow/workflows.go @@ -647,16 +647,6 @@ func getStreamState(stream *vtctldatapb.Workflow_Stream, rstream *tabletmanagerd return rstream.State.String() } -type GenericStream interface { - *tabletmanagerdatapb.ReadVReplicationWorkflowResponse_Stream | *vtctldatapb.Workflow_Stream -} - -type Stream[T GenericStream] struct { - TransactionTimestamp *vttimepb.Time - TimeUpdated *vttimepb.Time - State binlogdatapb.VReplicationWorkflowState -} - // getVReplicationTrxLag estimates the actual statement processing lag between the // source and the target. If we are still processing source events it is the // difference between current time and the timestamp of the last event. If