Skip to content

feat(kv): read bounded authoritative snapshots after a leader barrier - #799

Merged
wolfy-j merged 3 commits into
mainfrom
feat/kv-authority-snapshot-reviewed
Sep 23, 2026
Merged

wolfy-j merged 3 commits into
mainfrom
feat/kv-authority-snapshot-reviewed

Conversation

@wolfy-j

@wolfy-j wolfy-j commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Follower-local KV snapshots can lag an accepted leader write. This PR adds AuthoritySnapshotReader to the Raft-backed KV engine: a leader barriers Raft, then returns selected keys (including authoritative absence) from one detached KV publication; followers forward through the existing relay instead of substituting local state.

Requests and replies use one versioned wire format with bounded envelopes (up to 256 keys and 64 KiB per reply), canonical key ordering, and strict decoding. Up to 32 authority operations are admitted concurrently. Correlation uses connection-derived ingress identity. Caller cancellation removes pending waiters; if a Raft barrier cannot be canceled, its permit remains held until the future finishes. Leadership and transport failures are operational errors, including a retryable unavailable result when no leader can be resolved.

This is an infrastructure API only. It does not activate Strong naming, change admission policy, or add workspace behavior. The three-node tests exercise real Raft with an in-process relay and synthetic ingress, not production internode/TLS.

Validation on current main: go test -race ./system/kv/... ./cluster/clustertest/... -count=1, go vet ./system/kv/... ./cluster/clustertest/..., and git diff --check. A GOARCH=386 package test remains blocked by the unchanged system/crdt/delta.go constant-overflow build error; wire lengths are checked before conversion to int.

@wolfy-j
wolfy-j requested a review from skhaz September 20, 2026 13:33
Base automatically changed from fix/internode-source-provenance to main September 21, 2026 16:56
@wolfy-j

wolfy-j commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Batch architecture review: inspected the codec, admission, cancellation, ingress binding and forwarding paths; focused authority/relay race tests pass. No production caller of ReadAuthoritySnapshot exists in this PR: only the interface, implementation and tests. Under the current requirement to avoid unused runtime vocabulary, hold this protocol/API until a concrete consumer and its consistency contract land together. Also the description says 32 keys while maxAuthoritySnapshotKeys is 256; maxAuthorityConcurrent is 32. Current main now has LocalSnapshotReader in api/store/kv/snapshot.go, so integrate deliberately rather than replacing that file.

@wolfy-j
wolfy-j merged commit affcf22 into main Sep 23, 2026
9 checks passed
@wolfy-j
wolfy-j deleted the feat/kv-authority-snapshot-reviewed branch September 23, 2026 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants