Skip to content

Commit ec27fff

Browse files
yushuqinClaude
andcommitted
fix: skip OnlineDDL filter during cancelMigrate (cancellation path)
When cancelMigrate=true, we should not exclude stopped OnlineDDL streams from the full read, as the cancellation path needs to see all streams to properly clean up. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 88ce82c commit ec27fff

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

go/vt/vtctl/workflow/stream_migrator.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,11 @@ func (sm *StreamMigrator) legacyReadSourceStreams(ctx context.Context, cancelMig
469469
}
470470
}
471471

472-
tabletStreams, err := sm.legacyReadTabletStreams(ctx, source.GetPrimary(), "NOT (workflow_type = 5 AND state = 'Stopped')")
472+
constraint := ""
473+
if !cancelMigrate {
474+
constraint = "NOT (workflow_type = 5 AND state = 'Stopped')"
475+
}
476+
tabletStreams, err := sm.legacyReadTabletStreams(ctx, source.GetPrimary(), constraint)
473477
if err != nil {
474478
return err
475479
}
@@ -575,7 +579,7 @@ func (sm *StreamMigrator) readSourceStreams(ctx context.Context, cancelMigrate b
575579
}
576580
}
577581

578-
tabletStreams, err := sm.readTabletStreams(ctx, source.GetPrimary(), nil, nil, false, true)
582+
tabletStreams, err := sm.readTabletStreams(ctx, source.GetPrimary(), nil, nil, false, !cancelMigrate)
579583
if err != nil {
580584
return err
581585
}

go/vt/wrangler/stream_migrater_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,7 @@ func TestStreamMigrateCancelWithStoppedStreams(t *testing.T) {
11561156

11571157
for i, dbclient := range tme.dbSourceClients {
11581158
// sm.stopStreams->sm.readSourceStreams->readTabletStreams('') and VReplicationExec(_vt.copy_state)
1159-
dbclient.addQuery("select id, workflow, source, pos, workflow_type, workflow_sub_type, defer_secondary_keys from _vt.vreplication where db_name='vt_ks' and workflow != 'test_reverse' and NOT (workflow_type = 5 AND state = 'Stopped')", sqltypes.MakeTestResult(sqltypes.MakeTestFields(
1159+
dbclient.addQuery("select id, workflow, source, pos, workflow_type, workflow_sub_type, defer_secondary_keys from _vt.vreplication where db_name='vt_ks' and workflow != 'test_reverse'", sqltypes.MakeTestResult(sqltypes.MakeTestFields(
11601160
"id|workflow|source|pos|workflow_type|workflow_sub_type|defer_secondary_keys",
11611161
"int64|varbinary|varchar|varbinary|int64|int64|int64"),
11621162
sourceRows[i]...),

0 commit comments

Comments
 (0)