Skip to content

Commit

Permalink
Make stopped by user err a variable
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Dec 15, 2023
1 parent 2ce1231 commit 67d55a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions go/vt/vttablet/tabletmanager/vdiff/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func (ct *controller) start(ctx context.Context, dbClient binlogplayer.DBClient)
case <-ctx.Done():
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "context has expired")
case <-ct.done:
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped")
return ErrVDiffStoppedByUser
default:
}
ct.workflowFilter = fmt.Sprintf("where workflow = %s and db_name = %s", encodeString(ct.workflow),
Expand All @@ -199,7 +199,7 @@ func (ct *controller) start(ctx context.Context, dbClient binlogplayer.DBClient)
case <-ctx.Done():
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "context has expired")
case <-ct.done:
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped")
return ErrVDiffStoppedByUser
default:
}
source := newMigrationSource()
Expand Down Expand Up @@ -326,7 +326,7 @@ func (ct *controller) saveErrorState(ctx context.Context, saveErr error) error {
case <-ctx.Done():
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "engine is shutting down")
case <-ct.done:
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped")
return ErrVDiffStoppedByUser
case <-time.After(retryDelay):
if retryDelay < maxRetryDelay {
retryDelay = time.Duration(float64(retryDelay) * 1.5)
Expand Down
6 changes: 3 additions & 3 deletions go/vt/vttablet/tabletmanager/vdiff/table_differ.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ func (td *tableDiffer) streamOneShard(ctx context.Context, participant *shardStr
case <-ctx.Done():
return vterrors.Wrap(ctx.Err(), "VStreamRows")
case <-td.wd.ct.done:
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped")
return ErrVDiffStoppedByUser
}
return nil
})
Expand Down Expand Up @@ -705,9 +705,9 @@ func (td *tableDiffer) updateTableProgress(dbClient binlogplayer.DBClient, dr *D
return err
}

// Update the in-memory lastPK as well so that we can restart the table
// diff if --max-diff-duration was specified.
if td.wd.opts.CoreOptions.MaxDiffSeconds > 0 {
// Update the in-memory lastPK as well so that we can restart the table
// diff if needed.
lastpkpb := &querypb.QueryResult{}
if err := prototext.Unmarshal(lastPK, lastpkpb); err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletmanager/vdiff/workflow_differ.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (wd *workflowDiffer) diff(ctx context.Context) error {
case <-ctx.Done():
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "context has expired")
case <-wd.ct.done:
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped")
return ErrVDiffStoppedByUser
default:
}

Expand All @@ -255,7 +255,7 @@ func (wd *workflowDiffer) diff(ctx context.Context) error {
case <-ctx.Done():
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "context has expired")
case <-wd.ct.done:
return vterrors.Errorf(vtrpcpb.Code_CANCELED, "vdiff was stopped")
return ErrVDiffStoppedByUser
default:
}
query, err := sqlparser.ParseAndBind(sqlGetVDiffTable,
Expand Down

0 comments on commit 67d55a9

Please sign in to comment.