Skip to content

test(go): fail when a manual group commit on a split primary drops membership - #4293

Merged
hubcio merged 2 commits into
apache:masterfrom
aperiodic-io:test/go-group-offset-store-membership
Sep 28, 2026
Merged

hubcio merged 2 commits into
apache:masterfrom
aperiodic-io:test/go-group-offset-store-membership

Conversation

@almostintuitive

Copy link
Copy Markdown
Contributor

Which issue does this PR address?

Relates to ##4292

Rationale

The maintainers asked that a new bug come with a failing test. This PR adds only
that test. The fix belongs in the Go SDK's offset-write routing, and is left for
discussion.

What changed?

In a cluster where partition 0's primary is not the metadata leader, a Go
StoreConsumerOffset for a consumer group is refused as not admitted. The SDK
then reconnects to the primary under a new client identity. The replayed commit
fails with ConsumerGroupPartitionNotOwned, and the group membership is lost.
Auto-commit polls avoid this through pollPrimary and the attached consumer
session, and the Rust SDK routes offset writes the same way.

TestE2E_SplitPrimaryManualCommitPreservesMembership runs on the existing
split-primary fixture. It joins a group and commits two offsets on partition 0,
then asserts that the commits succeed, the session stays on the coordinator, the
client id is unchanged and the membership count is still 1. A new ignored
harness test,
given_split_primaries_when_go_group_commits_manually_should_preserve_membership,
drives it; the existing Go routing test now shares its runner. A
TODO(#4292) in StoreConsumerOffset marks where the fix belongs.

Like its auto-commit sibling, the harness test is #[ignore] because it needs
Go, so it does not turn CI red.

Local Execution

  • Not passed: the new test fails as intended, 3 of 3 runs, with
    consumer group member with client id: 0 does not own partition: 0 ... (session 127.0.0.1:20016 -> 127.0.0.1:20000). The existing
    given_split_primaries_when_go_group_auto_commits_should_preserve_membership
    passed in the same runs.
  • Pre-commit hooks: prek run --files <changed> ran. Everything passed
    (cargo fmt, go fmt, go mod tidy, typos, whitespace) except license-headers,
    which could not run because hawkeye is not installed. All three touched
    files already carry the ASF header and the diff does not touch it. The
    pre-push golangci-lint (foreign/go) passed, and
    cargo clippy -p integration --all-features --tests -- -D warnings is clean.

AI Usage

  1. Claude (Claude Code).
  2. Investigation (a standalone Docker reproduction first, then reading the Go
    SDK's sendFrame failover path and the server's consumer-group fence), the
    test and the write-up.
  3. The test was run against a 3-node harness cluster and fails with the error
    above. The server log confirms that the commit arrived under a new client id.
    Its precondition (coordinator and partition primary are different nodes) is
    asserted by the fixture. Every assertion before the commit (join,
    membership count 1) passes, so it cannot fail for an unrelated reason.
  4. Yes.

🤖 Generated with Claude Code

…mbership

A Go StoreConsumerOffset for a consumer group, on a partition whose
primary is not the metadata leader, is refused as not admitted. sendFrame
then walks the roster and reconnects to the primary under a new client
identity. The replayed commit fails with ConsumerGroupPartitionNotOwned
and the membership is lost. Auto-commit polls avoid this through the
attached consumer session, and the Rust SDK routes offset writes the
same way.

Add TestE2E_SplitPrimaryManualCommitPreservesMembership on the
split-primary fixture, driven by a new ignored harness test that shares
the Go runner with the auto-commit test. It fails today. A TODO in
StoreConsumerOffset marks where the fix belongs.

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

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.99%. Comparing base (d2f9706) to head (15a0469).

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #4293       +/-   ##
=============================================
- Coverage     87.56%   53.99%   -33.57%     
- Complexity     1575     1576        +1     
=============================================
  Files          1284     1284               
  Lines        225392   183384    -42008     
  Branches     188756   146748    -42008     
=============================================
- Hits         197366    99025    -98341     
- Misses        23292    79732    +56440     
+ Partials       4734     4627      -107     
Components Coverage Δ
Rust Core 46.28% <ø> (-42.48%) ⬇️
Java SDK 68.70% <ø> (+0.01%) ⬆️
C# SDK 77.41% <ø> (-0.02%) ⬇️
Python SDK 90.97% <ø> (ø)
PHP SDK 85.67% <ø> (ø)
Node SDK 96.43% <ø> (+1.68%) ⬆️
Go SDK 70.11% <ø> (+0.05%) ⬆️
Files with missing lines Coverage Δ
foreign/go/client/tcp/tcp_offset_management.go 100.00% <ø> (ø)

... and 497 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 marked this pull request as ready for review September 28, 2026 09:41
@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Sep 28, 2026
@hubcio
hubcio merged commit 11dd94c into apache:master Sep 28, 2026
76 checks passed
@github-actions github-actions Bot removed the S-waiting-on-review PR is waiting on a reviewer label Sep 28, 2026
Luishfs pushed a commit to Luishfs/iggy that referenced this pull request Sep 28, 2026
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.

3 participants