Skip to content

Commit

Permalink
Minor changes from self review
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 fa3ce54 commit 14b0032
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,7 @@ func (s *Server) MoveTablesComplete(ctx context.Context, req *vtctldatapb.MoveTa
if req.IgnoreSourceKeyspace {
opts = append(opts, IgnoreSourceKeyspace())
}

ts, state, err := s.getWorkflowState(ctx, req.GetTargetKeyspace(), req.GetWorkflow(), opts...)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1391,6 +1392,7 @@ func (s *Server) WorkflowDelete(ctx context.Context, req *vtctldatapb.WorkflowDe
if req.IgnoreSourceKeyspace {
opts = append(opts, IgnoreSourceKeyspace())
}

ts, state, err := s.getWorkflowState(ctx, req.GetKeyspace(), req.GetWorkflow(), opts...)
if err != nil {
s.Logger().Errorf("failed to get VReplication workflow state for %s.%s: %v", req.GetKeyspace(), req.GetWorkflow(), err)
Expand Down Expand Up @@ -2291,6 +2293,7 @@ func (s *Server) dropSources(ctx context.Context, ts *trafficSwitcher, removalTy

func (s *Server) dropArtifacts(ctx context.Context, keepRoutingRules bool, sw iswitcher, opts ...WorkflowActionOption) error {
wopts := processWorkflowActionOptions(opts)

if !wopts.ignoreSourceKeyspace {
if err := sw.dropSourceReverseVReplicationStreams(ctx); err != nil {
return err
Expand Down
10 changes: 6 additions & 4 deletions go/vt/vtctl/workflow/server_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ func WithLogger(l logutil.Logger) ServerOption {
}

// workflowActionOptions configure a workflow's optional behavior when
// performing actions in the worfklow server.
// workflowActionOptions are set by the WorkflowActionOption values passed
// to the server functions.
// performing actions in the worfklow server. Note: these should be used
// for options that are rarely used so that most callers do not need to
// specify any values for them. workflowActionOptions are set by the
// WorkflowActionOption values passed to the server functions.
type workflowActionOptions struct {
ignoreSourceKeyspace bool
}

// WorkflowActionOption alters how we perform the certain workflow operations.
// WorkflowActionOption alters how we perform the certain workflow operations
// in the worfklow server.
type WorkflowActionOption interface {
apply(*workflowActionOptions)
}
Expand Down

0 comments on commit 14b0032

Please sign in to comment.