From a1f1af9ca08a7dae3eb1a4d3dc786c9ca98e3139 Mon Sep 17 00:00:00 2001 From: Priya Bibra Date: Fri, 13 Oct 2023 10:20:29 -0700 Subject: [PATCH] add comments Signed-off-by: Priya Bibra --- go/vt/vtgate/vstream_manager.go | 6 ++++++ go/vt/vtgate/vstream_manager_test.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/vstream_manager.go b/go/vt/vtgate/vstream_manager.go index 53f5fcead8d..c8694606ec2 100644 --- a/go/vt/vtgate/vstream_manager.go +++ b/go/vt/vtgate/vstream_manager.go @@ -691,6 +691,10 @@ 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) @@ -698,6 +702,8 @@ func (vs *vstream) isRetriableError(err error) (bool, bool) { 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 } diff --git a/go/vt/vtgate/vstream_manager_test.go b/go/vt/vtgate/vstream_manager_test.go index a26e9fc4db5..74c975e58a6 100644 --- a/go/vt/vtgate/vstream_manager_test.go +++ b/go/vt/vtgate/vstream_manager_test.go @@ -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))