Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Priya Bibra <[email protected]>
  • Loading branch information
pbibra committed Oct 13, 2023
1 parent a843d9d commit a1f1af9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions go/vt/vtgate/vstream_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,19 @@ func (vs *vstream) streamFromTablet(ctx context.Context, sgtid *binlogdatapb.Sha
}
}

// isRetriable determines whether we should exit immediately or retry the vstream.
// The first return value determines if the error is retriable, the second indicates whether
// the tablet on which the error occurred should be ommitted from the candidate list of tablets
// to choose from on the retry.
func (vs *vstream) isRetriableError(err error) (bool, bool) {
errCode := vterrors.Code(err)

if errCode == vtrpcpb.Code_FAILED_PRECONDITION || errCode == vtrpcpb.Code_UNAVAILABLE {
return true, false
}

// If there is a GTIDSet Mismatch on the tablet or if the tablet cannot be found,
// omit it from the candidate list in the TabletPicker on retry.
if (errCode == vtrpcpb.Code_INVALID_ARGUMENT && strings.Contains(err.Error(), "GTIDSet Mismatch")) || errCode == vtrpcpb.Code_NOT_FOUND {
return true, true
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/vstream_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func TestVStreamRetriableErrors(t *testing.T) {

vsm := newTestVStreamManager(ctx, hc, st, cells[0])

// always have the local cell tablet error so it's ignored on retry and we pick the other one
// Always have the local cell tablet error so it's ignored on retry and we pick the other one
// if the error requires ignoring the tablet on retry
sbc0.AddVStreamEvents(nil, vterrors.Errorf(tcase.code, tcase.msg))

Expand Down

0 comments on commit a1f1af9

Please sign in to comment.