Repository navigation
Fence partition logs across lease changes - #327
Merged
PaxMachinaOne merged 4 commits intoNov 13, 2026
Merged
Conversation
PaxMachinaOne
marked this pull request as ready for review
November 13, 2026 09:39
PaxMachinaOne
approved these changes
Nov 13, 2026
PaxMachinaOne
left a comment
Collaborator
There was a problem hiding this comment.
- Logs reload after lease changes; stale handles and callbacks are fenced.
- Non-owner fetches redirect; Metadata reports the current owner.
- Conditional S3 writes prevent overwrites and destructive collision cleanup.
Reproduced offsets 0, 1, 1 before; regression now verifies 0, 1, 2 with acknowledged data preserved.
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.
Summary
Fixes #324. Bind each cached partition log to the etcd revision of its lease acquisition, evict it on lease loss, and restore offsets and S3 segments before using a new acquisition. Retained handles and delayed restore/flush callbacks are fenced. Non-owners return
NOT_LEADER_OR_FOLLOWERfor fetches, and Metadata reports the current lease owner.Create segments with
If-None-Match: *before uploading their indexes. A losing writer cannot overwrite the segment or index, and collision cleanup never deletes the winner's objects. Ambiguous segment PUT failures preserve any orphan and subsequent collisions fail closed. Schema registry retries verify and reuse identical content-addressed schema objects.Testing
91f64e9(the affected log/lease paths match upstream): A -> B -> A returns offsets 0, 1, 1, with a stale fetch and Metadata leader.go test -race ./cmd/broker ./pkg/metadata ./pkg/storagepassed.go test ./...passed on the initial PR head (5aa41b0); affected packages passed with the race detector after the review follow-up.go test -race ./pkg/schemaregistry -run '^(TestLargeSchemaGoesToS3|TestJSONThreeRegistryConcurrency)$' -count=1passed.make test-produce-consumeunavailable locally because Docker is not running.Checklist
Review follow-up
The initial Go CI failure was the published API gate: callback fields made three exported config structs non-comparable. Existing config layouts and constructors are now unchanged; optional callbacks live in separate options types, with compile-time coverage for legacy literals and comparability.
Review regressions reproduced and fixed:
Validation: the API compatibility script passes; race-enabled broker, metadata, storage, and broker-library suites pass; the startup lost-response test passes with the race detector. All three newly reproduced review regressions fail on the initial PR head and pass with these fixes.
The offset publication path also holds the read-state mutex while committing offsets and publishing the corresponding local segment. A regression reproduces the former
OFFSET_OUT_OF_RANGEwindow during a successful append; readers now wait until both are consistent.Final validation on
c26ae73: fullgo vet ./..., fullgo test -race ./..., and the published API compatibility gate pass locally. The latest hosted run has passed its API and vet steps and is running the remaining tests. Legacy unkeyed-literal assertions live in their owning packages so vet checks remain enabled.