fix(archiver): propagate context in rearchiveRange and fix structured log#59
Open
erhnysr wants to merge 1 commit into
Open
fix(archiver): propagate context in rearchiveRange and fix structured log#59erhnysr wants to merge 1 commit into
erhnysr wants to merge 1 commit into
Conversation
… log
Two bugs fixed:
1. rearchiveRange used context.Background() unconditionally, preventing
cancellation on archiver shutdown or HTTP request timeout. The function
now accepts a context.Context and passes it to retry.Do and
persistBlobsForBlockToS3. The HTTP handler passes r.Context() so the
operation is cancelled when the 60-second middleware timeout fires or
the client disconnects.
2. waitObtainStorageLock logged the lockfile write failure with a printf-
style format string ("failed to write to lockfile: %v") instead of a
structured key/value field, causing the error to be silently swallowed
by the structured logger. Fixed to use ("failed to write to lockfile",
"err", err).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
🟡 Heimdall Review Status
|
Author
|
Hi! Just checking in on this PR — happy to address any feedback or rebase if needed. Let me know if there's anything I can clarify about the context propagation fix. |
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.
Fixes #58.
Changes
1. Context propagation in
rearchiveRangerearchiveRangepreviously usedcontext.Background()for bothretry.DoandpersistBlobsForBlockToS3, making it impossible to cancel the operation on archiver shutdown or HTTP request timeout.context.Contextretry.DoandpersistBlobsForBlockToS3r.Context(), so the 60-second middleware timeout and client disconnects correctly abort the operationcontext.Background()2. Structured logging fix in
waitObtainStorageLocka.log.Crit("failed to write to lockfile: %v", err)passed%vas a key name to the structured logger, silently dropping the error value from log output. Changed toa.log.Crit("failed to write to lockfile", "err", err).Test plan
go test ./archiver/...)go build ./...clean🤖 Generated with Claude Code