Skip to content

Commit

Permalink
Restore unintentionally deleted condition
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Oct 16, 2024
1 parent e8edd10 commit 118e0b3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3138,10 +3138,6 @@ func (s *Server) WorkflowSwitchTraffic(ctx context.Context, req *vtctldatapb.Wor
span, ctx := trace.NewSpan(ctx, "workflow.Server.WorkflowSwitchTraffic")
defer span.Finish()

if req == nil {
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid nil request")
}

span.Annotate("keyspace", req.Keyspace)
span.Annotate("workflow", req.Workflow)
span.Annotate("tablet-types", req.TabletTypes)
Expand Down Expand Up @@ -3191,6 +3187,14 @@ func (s *Server) WorkflowSwitchTraffic(ctx context.Context, req *vtctldatapb.Wor
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid action for Migrate workflow: SwitchTraffic")
}

if direction == DirectionBackward && ts.IsMultiTenantMigration() {
// In a multi-tenant migration, multiple migrations would be writing to the same
// table, so we can't stop writes like we do with MoveTables, using denied tables,
// since it would block all other migrations as well as traffic for tenants which
// have already been migrated.
return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "cannot reverse traffic for multi-tenant migrations")
}

// We need this to know when there isn't a reverse workflow to use.
onlySwitchingReads := !startState.WritesSwitched && !switchPrimary

Expand Down

0 comments on commit 118e0b3

Please sign in to comment.