fix(replica): bound resumable reader retries#1360
Open
corylanou wants to merge 1 commit into
Open
Conversation
Partial reads returned data without preserving the retry count, so each caller read reset the retry budget. Sustained truncated streams could therefore reopen indefinitely without surfacing an error or entering replication backoff. Track retries for the lifetime of each resumable reader so initial opens and reconnects share the same bounded budget.
PR Build Metrics✅ All clear — no issues detected
Binary Size
Dependency ChangesNo dependency changes. govulncheck OutputBuild Info
🤖 Updated on each push. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Bounds reconnect attempts across the complete lifetime of a resumable LTX stream instead of restarting the retry budget on every caller read. Adds an HTTP regression test that truncates every response and counts accepted TCP connections.
Scope: This changes resumable-stream retry accounting only. It does not change the S3 transport configuration, AWS SDK retry policy, compaction scheduling, or retention behavior.
Motivation and Context
The retry counter was local to each
Readcall. When a response returned bytes together with a premature EOF or transport error, the reader closed that body, suppressed the error so the caller could consume the bytes, and reopened on the next call. That next call started the retry counter at zero again, so a sufficiently large source could reconnect indefinitely without surfacing an error or entering replication backoff.The release history explains the v0.5.14 regression shape:
The S3 client caches one transport per replica, AWS SDK middleware drains and closes failed non-streaming responses, and the resumable reader closes the previous successful
GetObjectbody before reopening. The unbounded cross-read retry reset was the resource-lifecycle defect.The regression server declares the full remaining
Content-Lengthbut returns one byte per connection. Before the fix, a 16-byte read opened 16 TCP connections, returned all data, and produced no error. After the fix, it opens at most four connections (the initial connection plus three retries) and returns the retry-limit error so normal replication backoff can engage.Fixes #1354
How Has This Been Tested?
Types of changes
Checklist
go fmt,go vet)go test ./...)