Repository navigation
fix(sdk): keep an explicit disconnect until the next connect - #4388
Conversation
|
Thanks for the PR. It is labeled Slash commands (own line, regular comment) move it around the queue:
See CONTRIBUTING.md for details. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4388 +/- ##
============================================
- Coverage 88.17% 88.12% -0.05%
Complexity 1726 1726
============================================
Files 1314 1314
Lines 264085 264306 +221
Branches 222739 222960 +221
============================================
+ Hits 232859 232923 +64
- Misses 25734 25840 +106
- Partials 5492 5543 +51
🚀 New features to boost your workflow:
|
|
/request-review @jiengup |
|
/request-review @hubcio |
|
Thanks @numinnex for the great review. I checked each point against the code, and these five hold:
The doc and test nits are valid too. So a flag checked at the entry points is not enough: it must be checked at every step of the reconnect sweep, on all three transports. That is the same code #4345 changes, and close to problems 5 to 8 of #4287 and to #3651. I asked on #4287 how you want it scoped before I change more of the state machine. |
|
/ready |
|
/request-review @numinnex |
|
@TomPlanche could you please rebase this? |
78939bf to
9d1521a
Compare
9d1521a to
061ef48
Compare
|
/ready |
Backups refused requests without directing clients to a partition's primary. HTTP tried writes on every node, and partition lookup required send permission. Add command 105 for partition routes with send or poll permission, NotPrimary (89), and replica IDs in cluster metadata. Routes carry incarnation, frontier and view. HTTP forwards to the partition primary in one hop; stale routes cannot chain relays. Run reads, polls and metadata commit waits outside the connection drain. Serialize metadata writes per connection and serve QUIC streams concurrently to prevent stalls. The Rust SDK shares session state, correlates TCP/WebSocket replies by request ID and bounds QUIC requests by deadlines. Add a driver with cached routes, one link per replica and one mutation at a time per partition history and for metadata. Clients do not use the driver yet. Derive owner generations from metadata ops to fence recreated groups. IGGY-OWNERSHIP-HISTORY-5 rejects older data before modifying it. Fence old partition control frames with incarnation in reserved bytes, preserving header sizes and field offsets. Close the owner handoff, retirement and offset-transfer gaps found in transfer emptied-table markers with offsets artifact v8. Exhausted partition repair windows escalate to state transfer. Rotations preserve the session ceiling and yield capacity; transfers reset repair budgets. Prove retained StartView history before committing or serving repair. Preserve unresolved proof across failed truncation and view changes, and retain acknowledged tails on commit-only updates. Metadata recovery protects pipeline-owned prepares; internal completions no longer become external reply attempts. Carry the transport disconnect fix from #4388 and retry relayed reads after primary failure. Simulator checks cover replacement histories and restarts. Keep unresolved requests through same-session re-login and transient refusals, bind the refusing endpoint and preserve committed-offset flags across restart. After offset file loss at boot, including all files or a whole kind directory, deleting the donor's last key can emit an emptied-table marker that drops those offsets on lagging receivers. That key may have been written after boot. Deleted groups remain only while stranded offsets are durable, avoiding permanent catalog retention for unreadable or unremovable files.
Backups refused requests without directing clients to a partition's primary. HTTP tried writes on every node, and partition lookup required send permission. Add command 105 for partition routes with send or poll permission, NotPrimary (89), and replica IDs in cluster metadata. Routes carry incarnation, frontier and view. HTTP forwards to the partition primary in one hop; stale routes cannot chain relays. Run reads, polls and metadata commit waits outside the connection drain. Serialize metadata writes per connection and serve QUIC streams concurrently to prevent stalls. The Rust SDK shares session state, correlates TCP/WebSocket replies by request ID and bounds QUIC requests by deadlines. Add a driver with cached routes, one link per replica and one mutation at a time per partition history and for metadata. Clients do not use the driver yet. Derive owner generations from metadata ops to fence recreated groups. IGGY-OWNERSHIP-HISTORY-5 rejects older data before modifying it. Fence old partition control frames with incarnation in reserved bytes, preserving header sizes and field offsets. Close the owner handoff, retirement and offset-transfer gaps found in transfer emptied-table markers with offsets artifact v8. Exhausted partition repair windows escalate to state transfer. Rotations preserve the session ceiling and yield capacity; transfers reset repair budgets. Prove retained StartView history before committing or serving repair. Preserve unresolved proof across failed truncation and view changes, and retain acknowledged tails on commit-only updates. Metadata recovery protects pipeline-owned prepares; internal completions no longer become external reply attempts. Carry the transport disconnect fix from #4388 and retry relayed reads after primary failure. Simulator checks cover replacement histories and restarts. Keep unresolved requests through same-session re-login and transient refusals, bind the refusing endpoint and preserve committed-offset flags across restart. After offset file loss at boot, including all files or a whole kind directory, deleting the donor's last key can emit an emptied-table marker that drops those offsets on lagging receivers. That key may have been written after boot. Deleted groups remain only while stranded offsets are durable, avoiding permanent catalog retention for unreadable or unremovable files.
Backups refused requests without directing clients to a partition's primary. HTTP tried writes on every node, and partition lookup required send permission. Add command 105 for partition routes with send or poll permission, NotPrimary (89), and replica IDs in cluster metadata. Routes carry incarnation, frontier and view. HTTP forwards to the partition primary in one hop; stale routes cannot chain relays. Run reads, polls and metadata commit waits outside the connection drain. Serialize metadata writes per connection and serve QUIC streams concurrently to prevent stalls. The Rust SDK shares session state, correlates TCP/WebSocket replies by request ID and bounds QUIC requests by deadlines. Add a driver with cached routes, one link per replica and one mutation at a time per partition history and for metadata. Clients do not use the driver yet. Derive owner generations from metadata ops to fence recreated groups. IGGY-OWNERSHIP-HISTORY-5 rejects older data before modifying it. Fence old partition control frames with incarnation in reserved bytes, preserving header sizes and field offsets. Close the owner handoff, retirement and offset-transfer gaps found in transfer emptied-table markers with offsets artifact v8. Exhausted partition repair windows escalate to state transfer. Rotations preserve the session ceiling and yield capacity; transfers reset repair budgets. Prove retained StartView history before committing or serving repair. Preserve unresolved proof across failed truncation and view changes, and retain acknowledged tails on commit-only updates. Metadata recovery protects pipeline-owned prepares; internal completions no longer become external reply attempts. Carry the transport disconnect fix from #4388 and retry relayed reads after primary failure. Simulator checks cover replacement histories and restarts. Keep unresolved requests through same-session re-login and transient refusals, bind the refusing endpoint and preserve committed-offset flags across restart. After offset file loss at boot, including all files or a whole kind directory, deleting the donor's last key can emit an emptied-table marker that drops those offsets on lagging receivers. That key may have been written after boot. Deleted groups remain only while stranded offsets are durable, avoiding permanent catalog retention for unreadable or unremovable files.
Which issue does this PR address?
Relates to #4287 (problems 2 and 3, and part of problems 6 and 8)
Rationale
An explicit
disconnect()must hold until the nextconnect(), as agreed on #4287: the test indisconnect_relogin.rsis the correct contract, not theIggyClientdocs. Problems 2 and 3 of #4287 break this rule for a client with auto-login credentials. This PR fixes these two problems.What changed?
After
disconnect(), a client with auto-login credentials came back on its own. The heartbeat kept running and its ping reconnected the client and signed in again, and a directping()orget_stats()did the same. Only an authenticated request such asget_me()failed, becausefail_if_not_authenticatedrejects it before the transport.Now the
Clienttrait impl ofdisconnect()sets a caller-intent flag on TCP, QUIC and WebSocket, and the trait impl ofconnect()clears it. While the flag is set,send_raw_with_responsefails withNotConnectedat once: no packets on the wire, no wait, no reconnect. The flag lives only in the trait impl, because leader redirection and the reconnect path call the inherentdisconnect(). A connection that drops withoutdisconnect()leaves the flag clear, so that loss still heals.IggyClient::disconnectalso stops the heartbeat, andconnectstarts it again. This removes the useless pings, and on QUIC it removes the redial that blockeddisconnect()inendpoint.wait_idle().The
Clienttrait now documents thedisconnect()contract. TheIggyClient, Python and C++ docs no longer say that auto-login undoes a disconnect. The last two lifecycle tests from #4344 lose their#[ignore], so all 10 cases ofclient_lifecycle.rsnow run.Local Execution
I used Zed in devcontainer mode. The build and the tests ran in the devcontainer, and
prekran on macOS.Passed:
cargo fmt --allandcargo clippy -p iggy_common -p iggy -p integration --all-features --all-targets -- -D warnings.Passed:
cargo test -p iggy --lib, with 234 tests.Passed: the lifecycle tests, with all 10 cases and none ignored, in 3 runs out of 3:
Passed: the
sdk::integration suite (69 passed, 0 ignored), which includesdisconnect_relogin.rs, and thecluster::suite (80 passed), because the flag sits in the reconnect path that failovers use.Passed: the Python lifecycle tests against a local server:
Passed:
cargo run --bin stub_gen. The stub diff contains only thedisconnect()docstring.Passed: pre-commit hooks with
SKIP=web-lint prek run --all-files. I skippedweb-lintbecause this PR does not changeweb/.AI Usage