Skip to content

Commit

Permalink
Fix dropTargets
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 5024848 commit a016515
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1948,15 +1948,13 @@ func (s *Server) dropTargets(ctx context.Context, ts *trafficSwitcher, keepData,
}

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

// Stop the workflow before we delete the artifacts so that it doesn't try and
// continue doing work, and producing errors, as we delete the related artifacts.
Expand Down

0 comments on commit a016515

Please sign in to comment.