Repository navigation
feat(consensus): persist retry receipts and shared sessions - #4387
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4387 +/- ##
============================================
- Coverage 87.91% 87.54% -0.38%
- Complexity 1578 1608 +30
============================================
Files 1298 1299 +1
Lines 233811 241165 +7354
Branches 194562 201571 +7009
============================================
+ Hits 205563 211136 +5573
- Misses 23339 24975 +1636
- Partials 4909 5054 +145
🚀 New features to boost your workflow:
|
98a2f15 to
63eaf2a
Compare
7264016 to
a621d98
Compare
|
/skill team-review-slim |
There was a problem hiding this comment.
Summary: Four experts reviewed the pull request at 75c26b5. The review found throughput changes on the HTTP write path, a fatal-vs-degrade contradiction in the partition commit walk, a misleading session error, stale foreign-SDK docs and guards, and one redundant journal barrier.
Counts: critical 0, warning 8, nit 4, simplification 1
This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.
|
/skill team-review-slim |
There was a problem hiding this comment.
Summary: One critical finding: a state-transfer install leaves pending_retry_checkpoint stale, so the next receipt reclaim deletes the live receipt file and the partition fails to reopen with StateFileCorrupted. The review also finds a full-reply copy on the primary commit path and a session-bind error that names the wrong cause, plus smaller items on a duplicate-reply copy, a redundant segment sync, HTTP retry docs, Java protocol parity, and a constant binding.
Counts: critical 1, warning 2, nit 4, simplification 1
Findings without an anchor on a changed line:
core/partitions/src/iggy_partition.rs:1062critical: After a state-transfer install,pending_retry_checkpointstill holds the pre-install frontier whilecheckpoint_op()has moved to the install op. This reclaim then deletes the receipt file the install wrote, so the partition fails to reopen withStateFileCorrupted. Reclaim frompersistence.checkpoint_op(), or clear the field on every reset.core/partitions/src/iggy_partition.rs:6636warning:reply.clone()allocates an aligned frame and copies the whole reply for every committed client operation on the primary. Freeze the reply once and share it with the commit cache, copying only for an in-process waiter.core/partitions/src/iggy_partition.rs:4573nit:cached.into_message()copies the retained reply into an owned frame, and the bus branch then converts it back toFrozen. Send the cachedFrozenon the bus path, and build the owned copy only for an in-process waiter.
This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.
8e102ae to
bb42eda
Compare
69ccfe8 to
fac9374
Compare
fac9374 to
4fb724b
Compare
Lost replies and capacity eviction could erase retry evidence and permit duplicate mutations after promotion or restart. Persist original results by session, group and request identity. Replay the first receipt even when a retry changes its payload, while preserving principal, session and client-operation guards. Protect committed capacity and publish receipt checkpoints before reclaiming their WAL. Refuse recovery when protection is absent or corrupt. Bind connections using client-owned proof, retain logical sessions across reconnects, renew leases only on authenticated activity, and retire protection across every allocated group before finalization. Preserve uncertainty when a later attempt is refused. Replay the exact encoded request after same-session resume and across refused or unreachable roster peers within its deadline. Expired sessions can log in again without replaying an ambiguous write under a new identity. Keep HTTP attachments invalidatable and serialize writes per partition under one deadline. Retain NoAck gates and reply slots through resolution, clean cancelled registrations, and retransmit retirement progress until all fences are acknowledged. Restore recovered receipts before admission while allowing live pipeline-backed commits. Allow intact empty WALs to elect, fence missing history before replacement WAL creation, and compare bootstrap revisions in the same domain. Introduce protocol 0.11, mandatory storage admission and exact peer build checks. Require explicit fresh-cluster initialization and Persisted durability for explicit writes without changing defaults. Align Go, Java, C# and Node login proofs and shared binding frames. Validate unsigned binding epochs and expose explicit producer durability in Rust and Python. Cover changed-payload retries, reply loss, crash recovery and reclamation, corruption, capacity pressure, lifecycle fences and transport retries. Document first-receipt integrity stamps and stable binding epochs.
Empty storage and Replicated writes were rejected despite existing startup and SDK contracts. Restore automatic metadata initialization and scope crash-safe retries to durable writes. Complete metadata directory loss still requires verified restore. Orderly shutdown must publish buffered WAL writes, and recovery must checkpoint them before advancing reserved offsets. Retain repair bodies across the gap and establish segment links before sends so descriptor exhaustion cannot block the shutdown barrier. Align replica, session and simulator fixtures, standalone formatting and isolated Miri with the supported contracts.
Explicit QUIC and WebSocket disconnects reused remembered credentials. Clear them like TCP while preserving involuntary transport recovery. Python CI polluted empty storage with logs and expected terminal errors to retry. Move logs beside data and align fixtures and docs with the existing explicit non-admission retry contract.
Singleton offsets could acknowledge an undurable WAL entry, purge recovery could replace the original receipt, and retirement could count reports for an older namespace set. Session replacement and later refusals also exposed retry identity and uncertainty gaps. Wait for the singleton WAL barrier, preserve original receipt stamps through purge, and fence missing partition history. Seal namespace revisions into retirement reports and discard stale quorum evidence. Queue checkpoint publication and reclaim only after completion. Keep retained SDK requests within their session and preserve uncertainty across later refusals. Fix explicit Node login after confirmed expiry, first-boot marker ordering, lost metadata wakeups and avoidable HTTP work. Set current and minimum binary protocol to 0.11.1 and regenerate Swift fixtures. Preserve automatic startup and Replicated writes; total metadata-directory loss remains outside automatic recovery. Document the public Rust API break: ConsensusSession bind and next_request_id return Result. Producers start fresh retries only after TransientNotAccepted; other failures return the unconfirmed batch. Explicit disconnect requires a new login. Validate with the full just nextest gate, affected foreign SDK suites, strict Clippy, configured hooks and Miri peer-frame tests.
Poll routes accepted malformed or mismatched bind replies, and the Node protocol guard missed patch drift. Validate bindings before polling and report both session identities on a resume mismatch. Avoid capacity scans when queue bounds prove space and retain only retirement entries during commit. Preserve receipt fences and HTTP ordering without adding reservation counters. Remove a redundant journal sync and correct session and protocol documentation.
Delayed persistence completion could delete the receipt checkpoint installed by state transfer. Reclaim against the published frontier. Share immutable replies on bus paths and avoid redundant retained-file barriers while preserving recovery truncation durability. Correct SDK session diagnostics and retry docs, and check Java protocol parity.
RequestIdExhausted was added to the Rust catalog without updating Swift's mirror, failing the golden check. Regenerate the fixture and add the matching Swift case so error-code parity stays intact.
Retirement could race with queued writes and reuse obsolete quorum reports. Transferred retry tables could also be checkpointed before their effects were applied, making restart recovery fail. Exclude writes while their session retirement is pending, qualify reports by view, and checkpoint only after applied state catches up. Retain one partition receipt, distinguish uncommitted transfer capacity, and isolate corrupt receipt recovery to its partition. Reuse resolved HTTP partitions and capture the admission frontier before routing waits. Warm peer identity outside shard runtimes.
Transport loss reset established sessions in Go, Java and C#, leaving old protection slots reserved and obscuring retry identity. Java, Node and C# also let later refusals overwrite an unknown mutation outcome. Resume established sessions with their original proof and permit fresh registration only after a definitive bind refusal. Preserve uncertainty across later refusals, fence retained Rust frames after transport locking, and restore retries for proven unsent attempts. Document session and API contracts and synchronize error catalogs.
Uninitialized partitions could remain offline after restart, while failed partitions stalled retirement and exhausted session capacity. Deleted or disabled users could also retain authenticated bindings. Persist incarnation evidence and retirement fences outside partition directories, batch retirement barriers, and preserve progress across truncation. Revoke sessions and memberships during commit and replay. Use protocol, release and storage identity for peer admission, and correct the NoAck and capacity contracts. Require storage format 3 and metadata snapshot format 8. Cover the reviewed failures with regressions and a three-replica restart test.
A retirement deadline could cancel an admitted WAL append and strand subsequent logins. Finish the active retirement before ending the budgeted pass and cover the cancellation window with a regression. Check full protocol version bounds and document stable release policy. Box initialization-test futures rejected by macOS Clippy.
Revoked sessions could invalidate snapshots, skip group cleanup during state transfer, and retain HTTP access through unexpired JWTs. Preserve retry receipts, replay against historical session state, and reject inactive principals before serving reads or attaching write sessions. Handle SDK lock poisoning and request exhaustion without losing session identity. Add regressions and correct the reviewed protocol and storage documentation.
Session eviction triggers automatic SDK login, which returns InvalidCredentials for a deleted account. Accept that denial.
After a lower request commits out of order, the higher request ID still owns the retained receipt. Correct the simulator's reversed retry expectations and compare the replayed receipt byte for byte, while asserting neither retry appends another message.
Replicated sends can wait for the next consensus tick after their body write completes. Resume eligible commits from the completion path while preserving recovery and durability gates. Cover replies without a tick and correct the WAL configuration comments for both durability policies.
External offset fixtures need committed retry capacity and the current directory layout after merging durable sessions. Use valid retry snapshots, preserve transfer and quota assertions, and reject legacy artifacts that lack session-qualified receipts.
ac036de to
77d9f51
Compare
The retention recovery test still writes the old offset layout, so boot rejects its receipt checkpoint before checking the WAL tail. Use version 4 and include every consumer kind's count plus dedup.
Lost replies and retry-cache eviction could allow duplicate mutations after promotion or restart. This PR persists retry protection for shared sessions and publishes receipt checkpoints before reclaiming the corresponding WAL. Retained receipts replay the original result for the same session, group, request ID and operation, subject to current authorization. A partition session retains the highest applied request ID's receipt; committing an out-of-order lower request does not replace it. Already-applied requests without a retained outcome return
RequestTooOld.Shared sessions use client-owned binding proof, authenticated lease renewal and ordered retirement. Partition retirement barriers batch up to 128 ended sessions. Finalization still requires reports covering every allocated partition from a common replica quorum. Reports track a separate partition-incarnation revision; purge and segment deletion do not reset retirement progress.
clients_table_maxanddedup_clients_maxbecome committed per-group limits, preserved across recovery and transfer. Live protection is not evicted to admit new clients.Durable initialization records outside partition directories distinguish partitions that never initialized from initialized partitions whose history was lost. Missing history keeps initialized partitions fenced pending recovery. A permanently failed partition counts toward retirement only after publishing a durable incarnation fence. Replacing its files or restarting does not clear that fence; failure to persist it keeps the session retained.
Metadata snapshot installation and log-tail replay preserve revoked-session history and newer retry protection. HTTP JWT requests and write-session attachment recheck that the owner exists and is active against locally applied metadata.
Compatibility and limits:
0.11.1..=0.11.1, including patch. Final stable-release bounds remain to be chosen. Released protocol 0.11.0 servers accept every 0.11.x patch, so an incompatible release needs a new minor version for those servers to reject it. Intermediate builds may share a number while requiring different layouts.Persisted; explicit offset retries requirePersistedandQuorum.Replicatedremains the default and uses buffered partition WAL writes without a per-send persistence barrier. HTTPack=noneconfirms dispatch only; same-session/partition writes wait for the prior reply or bounded deadline. Purge preserves retained send receipts without restoring purged messages.ConsensusSession::bindandnext_request_idnow returnResult. ExternalVsrSessionControlimplementations must providesession_identityandsession_bind_secret. Explicit disconnect clears remembered login and local identity; configured AutoLogin can authenticate a later connection.TransientNotAcceptedor proven presubmissionNotConnected/CannotEstablishConnection. HTTP failures use separate transport retry settings. Uncertain and terminal failures return the unconfirmed batch; an application resend can duplicate an earlier uncertain mutation. Receipt access after permission revocation and general replica-routing/cancellation APIs remain follow-up work.Rust, Go, Java, C#, Node and Rust-backed bindings use the coordinated login/binding contract. Established Go/Java/C# sessions resume coordinator connections with
BindSession, retaining identity and sequence; terminalUnauthenticatedorStaleClientbind refusals permit fresh registration. Swift golden fixtures and error mirrors are updated from Rust.Depends on merged #4365.