Skip to content

Commit

Permalink
More seperation of source and target in cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Feb 12, 2025
1 parent a016515 commit bedabd7
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2208,20 +2208,12 @@ func (s *Server) dropSources(ctx context.Context, ts *trafficSwitcher, removalTy
sw = &switcher{ts: ts, s: s}
}

// Lock the source and target keyspaces.
// Lock the source keyspace.
ctx, sourceUnlock, lockErr := sw.lockKeyspace(ctx, ts.SourceKeyspaceName(), "DropSources")
if lockErr != nil {
return defaultErrorHandler(ts.Logger(), fmt.Sprintf("failed to lock the %s keyspace", ts.SourceKeyspaceName()), lockErr)
}
defer sourceUnlock(&err)
if ts.TargetKeyspaceName() != ts.SourceKeyspaceName() {
lockCtx, targetUnlock, lockErr := sw.lockKeyspace(ctx, ts.TargetKeyspaceName(), "DropSources")
if lockErr != nil {
return defaultErrorHandler(ts.Logger(), fmt.Sprintf("failed to lock the %s keyspace", ts.TargetKeyspaceName()), lockErr)
}
defer targetUnlock(&err)
ctx = lockCtx
}

if !force {
if err := sw.validateWorkflowHasCompleted(ctx); err != nil {
Expand All @@ -2239,10 +2231,6 @@ func (s *Server) dropSources(ctx context.Context, ts *trafficSwitcher, removalTy
if err := sw.dropSourceDeniedTables(ctx); err != nil {
return nil, err
}
if err := sw.dropTargetDeniedTables(ctx); err != nil {
return nil, err
}

case binlogdatapb.MigrationType_SHARDS:
s.Logger().Infof("Removing shards")
if err := sw.dropSourceShards(ctx); err != nil {
Expand Down

0 comments on commit bedabd7

Please sign in to comment.