Skip to content

Commit

Permalink
fix nits
Browse files Browse the repository at this point in the history
Signed-off-by: Priya Bibra <pbibra@slack-corp.com>
  • Loading branch information
pbibra committed Oct 17, 2023
1 parent 0bc2cce commit ff8bfb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions go/vt/vtgate/vstream_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ type vstreamManager struct {
// maxSkewTimeoutSeconds is the maximum allowed skew between two streams when the MinimizeSkew flag is set
const maxSkewTimeoutSeconds = 10 * 60

// tabletPickerContextTimeout is the timeout for the child context used to select candidate tablets
// for a vstream
const tabletPickerContextTimeout = 90 * time.Second

// vstream contains the metadata for one VStream request.
type vstream struct {
// mu protects parts of vgtid, the semantics of a send, and journaler.
Expand Down Expand Up @@ -500,8 +504,8 @@ func (vs *vstream) streamFromTablet(ctx context.Context, sgtid *binlogdatapb.Sha
}

// Create a child context with a stricter timeout when picking a tablet.
// This will prevent hanging in the case no tablets are found
tpCtx, tpCancel := context.WithTimeout(context.Background(), 90*time.Second)
// This will prevent hanging in the case no tablets are found.
tpCtx, tpCancel := context.WithTimeout(ctx, tabletPickerContextTimeout)
defer tpCancel()

tablet, err := tp.PickForStreaming(tpCtx)
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 @@ -455,7 +455,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
// if the error requires ignoring the tablet on retry
// if the error requires ignoring the tablet on retry.
sbc0.AddVStreamEvents(nil, vterrors.Errorf(tcase.code, tcase.msg))

if tcase.ignoreTablet {
Expand Down

0 comments on commit ff8bfb4

Please sign in to comment.