Skip to content

test(sdk): fail when sends to split partition primaries move the session - #4437

Closed
almostintuitive wants to merge 1 commit into
apache:masterfrom
aperiodic-io:test/sdk-send-partition-primary-routing
Closed

almostintuitive wants to merge 1 commit into
apache:masterfrom
aperiodic-io:test/sdk-send-partition-primary-routing

Conversation

@almostintuitive

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Relates to #4436

Rationale

New bugs should come with a failing test, so this PR adds only that test. The
fix belongs in the Rust SDK's send path, and is left for discussion.

What changed?

When two partitions of a topic have their primaries on different nodes, a
producer that alternates between them is refused (TransientNotAccepted) on
every send. It waits out two 2s transient windows, then moves its only session to
another node. Each send takes about 4s. Polls avoid this through PollRouter.
Sends have no equivalent.

given_partitions_on_different_primaries_when_sending_round_robin_should_keep_the_session
builds on the existing seed_split_primaries fixture. Partition 0 keeps its
primary through a metadata-only election. Partition 1, created afterwards with
create_partitions, is seeded onto the metadata leader. A precondition checks
via GET_POLL_ROUTING that the two primaries are on different nodes. After one
warm-up send to each partition, the test alternates four sends and asserts that
none of them moves the session to another node. It is
#[ignore = "#4436: ..."], so default CI stays green, and it runs with
--ignored.

Local Execution

  • Not passed: the new test fails as intended, 3 of 3 runs on master @
    43fb44364, every time with
    4 of 4 sends moved it to another node ... [(0, 2, 0, 4.020694671s), (1, 0, 2, 4.018801233s), (0, 2, 0, 4.019829788s), (1, 0, 2, 4.018055753s)].
    On tag iggy-0.11.0 it fails the same way (about 4.07s per send).
    cargo fmt --all --check and
    cargo clippy -p integration --all-features --tests -- -D warnings are clean.
  • Pre-commit hooks: prek run --files <changed> ran. Everything that applies
    passed (typos, whitespace, trailing newline, binary artifacts, skills) except
    license-headers, which could not run because jq/hawkeye are not
    installed. The file already carries the ASF header and the diff does not
    touch it. cargo fmt and clippy ran separately (see above).
  • The last change before the push only filled in the issue number in the
    #[ignore] reason. The file was checked with rustfmt --check after that
    change, but the test was not rerun.

AI Usage

  1. Claude (Claude Code).
  2. Investigation (reading the TCP client's refusal, routing-lock and roster-walk
    path, and comparing it with PollRouter), the test and the write-up.
  3. The test was run against the 3-node harness cluster and fails as shown
    above. The client log confirms the mechanism: about 4s of refusals, then
    trying the next cluster node or redirecting to leader on every send. The
    fixture asserts its precondition, that the partition primaries are on
    different nodes, before any send, so it cannot fail for an unrelated reason.
  4. Yes.

🤖 Generated with Claude Code

A producer alternating between two partitions whose primaries are on
different nodes waits out two transient refusal windows (about 4s) and
moves its only session on every send. Polls avoid this through
PollRouter; sends have no equivalent.

The new test builds on seed_split_primaries: partition 0 keeps its
primary through a metadata-only election, and partition 1, created
afterwards, is seeded onto the metadata leader. After a warm-up send to
each partition it alternates four sends and asserts the session never
moves. It is ignored with apache#4436 so default CI stays green.

Relates to apache#4436

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Thanks for the PR. It is labeled S-waiting-on-review and queued for review.

Slash commands (own line, regular comment) move it around the queue:

  • /ready - back to S-waiting-on-review after addressing feedback
  • /author - flip to S-waiting-on-author while you finish changes
  • /request-review @user-or-team - request a reviewer
  • /pin - exempt the PR from the stale bot, /unpin to undo

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Oct 7, 2026
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.55%. Comparing base (43fb443) to head (240bcc4).

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #4437       +/-   ##
=============================================
- Coverage     87.54%   70.55%   -17.00%     
  Complexity     1608     1608               
=============================================
  Files          1300     1246       -54     
  Lines        241253   145869    -95384     
  Branches     201557   106173    -95384     
=============================================
- Hits         211207   102914   -108293     
- Misses        25014    38052    +13038     
+ Partials       5032     4903      -129     
Components Coverage Δ
Rust Core 66.90% <ø> (-22.38%) ⬇️
Java SDK 68.82% <ø> (ø)
C# SDK 61.43% <ø> (ø)
Python SDK 91.25% <ø> (ø)
PHP SDK 85.67% <ø> (ø)
Node SDK 96.65% <ø> (ø)
Go SDK 70.28% <ø> (ø)
C++ SDK 86.60% <ø> (ø)
see 510 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.

@almostintuitive

Copy link
Copy Markdown
Contributor Author

Closing: #4506 and #4561 replaced the single-session send path this test exercised with partition lanes and per-replica links, and the multi-leader routing work is the fix for #4436, as noted on the issue. The test pins the old design, so it no longer applies. #4436 can be closed once you are happy the routing covers it.

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.

1 participant