Skip to content

Commit

Permalink
VReplication SwitchWrites: Properly return errors in SwitchWrites (#1…
Browse files Browse the repository at this point in the history
…4800)

Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps authored Dec 19, 2023
1 parent b500cdf commit 91bb0b9
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 91bb0b9

Please sign in to comment.