Skip to content

Commit

Permalink
Address more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
odeke-em committed Dec 17, 2024
1 parent 0ed4582 commit 367ecbd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions spanner/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,12 @@ type resumableStreamDecoder struct {

gsc *grpcSpannerClient

// reqIDInjector is generated once per stream, unless the stream gets
// broken and this case we generate a new request_number.
// reqIDInjector is generated once per stream, unless the stream
// gets broken and in that case a fresh one is generated.
reqIDInjector *requestIDWrap
retryAttempt uint32
// retryAttempt is is incremented whenever a retry happens, and it is
// reset whenever a new reqIDInjector is created afresh.
retryAttempt uint32
}

// newResumableStreamDecoder creates a new resumeableStreamDecoder instance.
Expand Down Expand Up @@ -615,7 +617,6 @@ func (d *resumableStreamDecoder) next(mt *builtinMetricsTracer) bool {
d.resumeToken = d.np.ResumeToken
d.changeState(queueingRetryable)
}
// In this case the stream was connected and we can increment retryAttempt.
return true
}
if d.bytesBetweenResumeTokens >= d.maxBytesBetweenResumeTokens && d.state == queueingRetryable {
Expand Down
4 changes: 0 additions & 4 deletions spanner/request_id_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ func (gsc *grpcSpannerClient) generateRequestIDHeaderInjector() *requestIDWrap {
return &requestIDWrap{md: md, nthRequest: gsc.nextNthRequest(), gsc: gsc}
}

func (riw *requestIDWrap) incrementNthRequest() {
riw.nthRequest = riw.gsc.nextNthRequest()
}

func (riw *requestIDWrap) withNextRetryAttempt(attempt uint32) gax.CallOption {
riw.gsc.generateAndInsertRequestID(riw.md, riw.nthRequest, attempt)
// If no gRPC stream is available, try to initiate one.
Expand Down

0 comments on commit 367ecbd

Please sign in to comment.