Skip to content

Commit

Permalink
[release-18.0] Backport: VReplication SwitchWrites: Properly return e…
Browse files Browse the repository at this point in the history
…rrors in SwitchWrites #14800 (#14824)

Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps authored Dec 20, 2023
1 parent 0edba3d commit 6e7937c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions go/vt/wrangler/traffic_switcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,11 @@ func (wr *Wrangler) SwitchWrites(ctx context.Context, targetKeyspace, workflowNa
ts, ws, err := wr.getWorkflowState(ctx, targetKeyspace, workflowName)
_ = ws
if err != nil {
handleError("failed to get the current workflow state", err)
return handleError("failed to get the current workflow state", err)
}
if ts == nil {
errorMsg := fmt.Sprintf("workflow %s not found in keyspace %s", workflowName, targetKeyspace)
handleError("failed to get the current workflow state", fmt.Errorf(errorMsg))
return handleError("failed to get the current workflow state", fmt.Errorf(errorMsg))
}

var sw iswitcher
Expand All @@ -508,7 +508,7 @@ func (wr *Wrangler) SwitchWrites(ctx context.Context, targetKeyspace, workflowNa

ts.Logger().Infof("Built switching metadata: %+v", ts)
if err := ts.validate(ctx); err != nil {
handleError("workflow validation failed", err)
return handleError("workflow validation failed", err)
}

if reverseReplication {
Expand Down Expand Up @@ -655,7 +655,7 @@ func (wr *Wrangler) SwitchWrites(ctx context.Context, targetKeyspace, workflowNa
return handleError("failed to update the routing rules", err)
}
if err := sw.streamMigraterfinalize(ctx, ts, sourceWorkflows); err != nil {
handleError("failed to finalize the traffic switch", err)
return handleError("failed to finalize the traffic switch", err)
}
if reverseReplication {
if err := sw.startReverseVReplication(ctx); err != nil {
Expand Down

0 comments on commit 6e7937c

Please sign in to comment.