Skip to content

feat(sdk)!: activate partition routing and recovery - #4561

Merged
hubcio merged 28 commits into
masterfrom
feat/sdk-partition-routing
Oct 20, 2026
Merged

hubcio merged 28 commits into
masterfrom
feat/sdk-partition-routing

Conversation

@hubcio

@hubcio hubcio commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Partition-aware components were not active across transports, and
uncertain writes lacked a consistent application recovery path.

Activate shared session owners, partition lanes and multiplexed
replica links across Rust, Go, C#, Java and Node SDKs. Retain frozen mutations for
explicit resolve or abandon with configurable count and byte limits.
End uncertain progress polls without replaying them. Swift supplies protocol
and retry compatibility; it does not expose retained-operation recovery,
mutation lanes, or pending-operation limits. Rust-backed C++, Python and PHP
bindings expose the Rust recovery APIs.

Require committed receipt proof before releasing uncertain lanes.
Preserve that proof through server reply rewrites and route offset
reads through partition-primary history gates.

Preserve FIFO admission, frozen payloads and one operation deadline
across safe retries and recovery. Refresh session credentials across
replica links and release retained buffers at their owning session. A detached
connection rebinds before deciding whether its session ended. MCP exposes
explicit resolve/abandon tools and exact operation IDs in recovery errors.

BREAKING CHANGE: Require fresh IGGY-BOUND-GRANTS-3 storage and
matching servers and SDKs. ReplyHeader byte 220 is the
committed-result marker; value 1 proves a committed result. Replayed successful
PAT creation returns PersonalAccessTokenAlreadyExists because the secret is
unrecoverable while preserving that commitment proof.
Retire commands 103, 104 and 123, remove producer retry configuration,
and update binding recovery/error APIs. VsrSessionControl drops
refresh_session_password and refresh_session_username. Direct C++
bridge calls require a per-call ErrorInfo argument. Node
Client.destroy() now aborts in-flight requests immediately, a sign-in
that reaches no endpoint rejects with NotConnectedError, and consumer
stream factories sign in at creation. The public Node Client._pool property
is removed. Go contracts.Client implementors must add ResolveOperation and
AbandonOperation, and IggyTcpClient.HandleLeaderRedirection is removed.

Relates to #4436. Continues the multi-leader routing work from #4506.
Placement and rebalancing will be raised as next PR.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Oct 15, 2026
@hubcio hubcio added the breaking:storage On-disk data format change - skips backwards compat CI label Oct 15, 2026
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.47082% with 182 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.68%. Comparing base (5d02e19) to head (12d34f0).

Files with missing lines Patch % Lines
core/sdk/src/driver.rs 98.16% 9 Missing and 12 partials ⚠️
core/sdk/src/clients/consumer.rs 97.64% 5 Missing and 14 partials ⚠️
core/common/src/traits/binary_impls/messages.rs 88.88% 13 Missing and 3 partials ⚠️
core/connectors/runtime/src/source.rs 94.21% 11 Missing and 3 partials ⚠️
core/sdk/src/client_wrappers/client_wrapper.rs 67.44% 14 Missing ⚠️
core/sdk/src/clients/client_builder.rs 0.00% 12 Missing ⚠️
core/sdk/src/clients/producer.rs 97.47% 4 Missing and 6 partials ⚠️
core/common/src/traits/binary_transport.rs 72.72% 9 Missing ⚠️
core/sdk/src/links/dial.rs 94.00% 2 Missing and 7 partials ⚠️
core/sdk/src/clients/client.rs 89.61% 7 Missing and 1 partial ⚠️
... and 17 more

❌ Your patch check has failed because the patch coverage (42.34%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4561      +/-   ##
============================================
+ Coverage     89.03%   89.68%   +0.65%     
- Complexity     1785     2146     +361     
============================================
  Files          1332     1343      +11     
  Lines        288630   289943    +1313     
  Branches     247077   246218     -859     
============================================
+ Hits         256971   260028    +3057     
+ Misses        26006    24181    -1825     
- Partials       5653     5734      +81     
Components Coverage Δ
Rust Core 90.92% <96.47%> (+0.22%) ⬆️
Java SDK 73.18% <ø> (+2.42%) ⬆️
C# SDK 81.30% <ø> (+14.87%) ⬆️
Python SDK 90.66% <ø> (+0.23%) ⬆️
PHP SDK 87.87% <ø> (+1.84%) ⬆️
Node SDK 95.23% <ø> (+0.11%) ⬆️
Go SDK 71.80% <ø> (+0.93%) ⬆️
C++ SDK 84.69% <ø> (+0.25%) ⬆️
Files with missing lines Coverage Δ
core/ai/mcp/src/main.rs 73.61% <100.00%> (+1.55%) ⬆️
core/ai/mcp/src/service/requests.rs 100.00% <ø> (ø)
core/binary_protocol/src/codes.rs 100.00% <ø> (ø)
core/binary_protocol/src/consensus/header.rs 86.51% <100.00%> (+0.16%) ⬆️
core/binary_protocol/src/consensus/reply_result.rs 100.00% <100.00%> (ø)
core/binary_protocol/src/dispatch.rs 89.13% <100.00%> (-0.24%) ⬇️
core/common/src/traits/binary_impls/mod.rs 97.33% <100.00%> (+2.88%) ⬆️
core/common/src/traits/client.rs 0.00% <ø> (ø)
core/common/src/traits/message_client.rs 100.00% <ø> (ø)
...es/configuration/quic_config/quic_client_config.rs 100.00% <100.00%> (ø)
... and 169 more

... and 95 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hubcio
hubcio force-pushed the feat/sdk-partition-routing branch 3 times, most recently from 89500c4 to 3504d9b Compare October 16, 2026 19:55

@spetz spetz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Five critical defects and ten warnings, all inline. Four of the criticals let a client lose track of a write that can have committed: the Rust producer and consumer resolve and discard another caller's uncertain operation, Go reports an uncertain write as ErrUnauthenticated, and Java grades a STALE_CLIENT eviction as a final refusal. The fifth is in Rust and Node: a one-node server behind NAT, a port-forward or a container port mapping becomes unreachable after a link drop in Rust, and right after login in Node, because both clients dial the advertised roster address instead of the configured one.

Comment thread core/sdk/src/clients/producer.rs Resolved
Comment thread core/sdk/src/tcp/tcp_client.rs Resolved
Comment thread foreign/go/client/tcp/tcp_driver.go Resolved
Comment thread core/sdk/src/binary/mod.rs Resolved
Comment thread core/sdk/src/links/replicas.rs Resolved
Comment thread core/consensus/src/plane_helpers.rs Resolved
Comment thread core/server/src/boot/mod.rs Resolved
@github-actions github-actions Bot added S-waiting-on-author PR is waiting on author response and removed S-waiting-on-review PR is waiting on a reviewer labels Oct 16, 2026
@hubcio
hubcio force-pushed the feat/sdk-partition-routing branch from 16676ce to 118eed2 Compare October 18, 2026 15:57

@spetz spetz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up at 118eed2. The fixes for the first review hold, with the gaps noted in the thread replies. One new critical: after a routine replica restart in a multi-node cluster, a Rust IggyConsumer stops consuming for good (core/sdk/src/driver.rs:954). The other inline comments are warnings that leave a group consumer, a connector source or a Java resolve stuck. Smaller findings can follow separately.

Comment thread core/sdk/src/driver.rs Resolved
Comment thread core/sdk/src/clients/consumer.rs Resolved
Comment thread core/connectors/runtime/src/source.rs Resolved
@hubcio
hubcio force-pushed the feat/sdk-partition-routing branch 2 times, most recently from 54dc47d to a722221 Compare October 19, 2026 13:32
Comment thread core/sdk/src/driver.rs Resolved
Comment thread foreign/go/client/tcp/tcp_driver.go Resolved
Comment thread core/sdk/src/links/replicas.rs Resolved
Comment thread foreign/go/client/tcp/tcp_replicas.go Resolved
Comment thread core/metadata/src/impls/metadata.rs Resolved
@hubcio
hubcio force-pushed the feat/sdk-partition-routing branch from a23f92a to 95625fb Compare October 19, 2026 17:05
hubcio added 14 commits October 20, 2026 06:39
Partition-aware components were not active across transports, and
uncertain writes lacked a consistent application recovery path.

Activate shared session owners, partition lanes and multiplexed
replica links across Rust and native SDKs. Retain frozen mutations for
explicit resolve or abandon with configurable count and byte limits.
End uncertain progress polls without replaying them.

Require committed receipt proof before releasing uncertain lanes.
Preserve that proof through server reply rewrites and route offset
reads through partition-primary history gates.

Preserve FIFO admission, frozen payloads and one operation deadline
across safe retries and recovery. Refresh session credentials across
replica links and release retained buffers at their owning session.

BREAKING CHANGE: Require fresh IGGY-BOUND-GRANTS-3 storage and
matching servers and SDKs. ReplyHeader byte 220 is the
committed-result marker; value 1 proves a committed result.
Retire commands 103, 104 and 123, remove producer retry configuration,
and update binding recovery/error APIs. VsrSessionControl drops
refresh_session_password and refresh_session_username. Direct C++
bridge calls require a per-call ErrorInfo argument. Node
Client.destroy() now aborts in-flight requests immediately, a sign-in
that reaches no endpoint rejects with NotConnectedError, and consumer
stream factories sign in at creation.

Relates to #4436. Continues the multi-leader routing work from #4506.
Placement and rebalancing will be raised as next PR.
A restored replica can refuse a live session's reads with status 40.
Rebind that link and retry refused reads within the existing deadline,
preserving mutation refusals and session identity.
An uncertain create or join blocked every later group initialization.
Remember and resolve the consumer's operation before joining again,
keeping unknown outcomes and other callers' operations intact.
A restarted producer loses the previous producer's uncertain IDs.
Resolve its retained lane blocker before retrying the full unsent
batch, while preserving the earlier operation's outcome.
Timeout and cancellation callbacks could replay before pending-ID
cleanup, then release the next resolver's claim a second time.
Replace terminal pending entries and retain each attempt only once.
Authenticated reads lost the authentication failure after user
deletion and eventually surfaced NotConnected.

Preserve the operation's session requirement across retries and
finish with Unauthenticated when automatic recovery ends unbound.
Keep successful reauthentication and detached-link recovery intact.
Cleanup swallowed uncertain stream deletions, leaving the shared
client's metadata lane blocked for subsequent tests.

Resolve retained operations and verify deletion before continuing.
Stop the test session on cleanup failure, and allow the maximum
partition test enough time for bounded recovery.
A leave resolved after a lost reply did not record the caller's intent,
so the next poll could join the group again. Apply membership effects
from the frozen request before releasing its lane, for typed calls,
raw requests and recovery. Cover a lost leave reply and subsequent poll.
A coordinator that stopped replying without closing TCP never triggered
failover. Close the timed-out PING channel and notify connection recovery
while keeping ordinary request timeouts isolated. Cover automatic
failover from an open but silent coordinator to a responsive replica.
The bridge timeout canceled sent metadata writes and left the shared
client blocked on their retained operations. Resolve a blocker before
retrying a later, unsent write within the same request deadline. Preserve
unknown outcomes and never abandon or resubmit the earlier mutation.

Cover delayed committed success and rejection, canceled recovery, and
subsequent topic creation on the same bridge against a real server.
Treating every PING timeout as a heartbeat failure closed the shared
channel for explicit system pings and broke late-reply isolation.
Mark scheduled heartbeats in their request state and restrict channel
recovery to that marker. Preserve explicit request timeout semantics.
Session replacement and cancellation could strand mutation lanes or
leave consumers stalled. Delayed sign-in could also undo disconnect.

Release stale reservations, settle refusals before roster refresh,
and guard sign-in finalization. Let session events control polling,
surface retained operation IDs, and restart interrupted connects.
Timed-out Produce and OffsetCommit operations left later writes
blocked on their clients. Resolve their retained outcomes before
admitting later writes, and report unresolved recovery as a timeout.
Token admission limits arrive in result bodies without commit proof.
Count them as denials instead of asserting a committed result type.
A lost binding can leave its session and writes recoverable. Rebind
NoSession links and replay frozen requests without resetting their
identity; retain terminal handling for other eviction reasons.
Close links after failed managed keepalive so silent peers redial.
A restored replica can reject an attachment while its session lives.
Rebind before resetting recovery state, preserve frozen mutations,
and restart replica slots after a finite retry budget is exhausted.
Document the recovery interface and routing API compatibility changes.
An unbound connection must not discard unrelated retained writes.
Rebind first and retain the eviction reason for terminal failures.
Retry malformed bind replies and accept positive pending byte limits
consistently with the other SDKs.
Detached links and uncertain group joins could strand recovery or
clear retained writes. Rebind live sessions and resolve owned joins.
Use per-lane waiter queues to avoid quadratic hot-lane admission,
and align positive pending byte limits with the other SDKs.
An uncertain tool write could block its lane without a recovery API.
Expose resolve and abandon tools with exact decimal operation IDs,
write permission checks, and documented commitment semantics.
A replayed token creation can prove commitment while returning an
already-exists error because its secret is unrecoverable. Document
that exception and Swift's narrower protocol compatibility scope.
A detached binding can still have a live session. Replay frozen
mutations after rebinding, while a NoSession bind ends recovery.
Router clearing reports sent writes as uncertain with their IDs.
Simplify the detached-link guards without changing their behavior.
Move the router-clear regression into the existing recovery suite
to keep the shared fixture class within its size limit.
The dashboard can accept logins before authentication is ready.
Retry user creation and accept conflicts from completed attempts.

Port Spetz's exact MQTT fixture fix from #4585
(3cd8e1f).
@hubcio
hubcio force-pushed the feat/sdk-partition-routing branch from 12c0ee9 to 12d34f0 Compare October 20, 2026 04:45
@hubcio
hubcio merged commit c37a94d into master Oct 20, 2026
116 checks passed
@github-actions github-actions Bot removed the S-waiting-on-author PR is waiting on author response label Oct 20, 2026
Arham-Begani added a commit to Arham-Begani/iggy that referenced this pull request Oct 21, 2026
Adapt the earlier redirect/shutdown and wrapper fixes to the replica-link
architecture introduced by apache#4561. Keep immediate request cancellation and
wait for every physical socket close before one final end event. Refuse new
links after destruction, retain listener removal, and await custom raw-client
destruction through SimpleClient. SingleClient now inherits Client's events.

Separate link diagnostics from the raw stream's special error event so internal
events.once recovery waits are not rejected by an expected replica failure.
Add focused wrapper and routing/destruction regression coverage and update the
lazy first-dial and all-replica event documentation.

Preserve the original contribution's AI attribution below. OpenAI Codex ported
the feature and tests to the new architecture and prepared this rebase. Local
validation and environment limitations are recorded separately; this commit
does not attest to human review or claim the PR is ready.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KqEXKVMqfFH6hmLUyQvjdS
AI-Assistance: OpenAI Codex
krishvishal added a commit that referenced this pull request Oct 22, 2026
Since #4561 a login replaces the session under concurrent calls, so the batch failed about 8% of CI runs; the same change is in #4619.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking:storage On-disk data format change - skips backwards compat CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants