Repository navigation
fix(binding-kafka): rejoin group when topic metadata is updated after joining - #3294
Merged
Merged
Conversation
…ated after assignment Add paired application and network scripts, with spec-level and client group ITs, for a consumer group whose member advises updated topic metadata after the first assignment has been received. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r
… assignment A group stream advising updated topic metadata after the member had joined and synced only triggered a heartbeat, so the new topics were never sent in a JoinGroup request and never assigned. Rejoin with the updated metadata, as the join group client already does. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r
…ated before the join group response Add paired application and network scripts, with spec-level and client group ITs, for a group stream whose member advises updated topic metadata while its join group request is awaiting a response. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r
… was in flight Topic metadata advised while a join group request was awaiting its response was stored but never sent, so the member synced an assignment that lacked the new topics. Track the metadata version sent in each join group request and rejoin after the sync group response when it is stale. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r
jfallows
force-pushed
the
fix/3290-group-rejoin-on-new-topic
branch
from
November 16, 2026 20:45
0845124 to
85fa621
Compare
…ated before the member assignment Add application scripts, a spec-level ID and a client group IT for a group stream whose member advises updated topic metadata after the join group response but before sending its member assignment. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r
…ompletes Rejoining as soon as updated topic metadata arrived replaced the active client before the sync group request was sent, so the member's assignment was never synced and the broker removed the member. Rejoin immediately only when the last join has already synced, otherwise rejoin after the sync group response. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r
Contributor
Author
|
Final real-broker result on the current head (
An earlier version of this branch (unconditional immediate rejoin on a metadata update) still stalled about 1 run in 30. In that case the update arrived between the join response and the sync, the rejoin skipped the SyncGroup, and Kafka removed the member after the rebalance timeout. That case now has its own The DISCONNECT 131 variant from the issue was not reproduced in any run, before or after, so it remains unexplained. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A group stream can advise updated topic metadata (a new topic added to the member's subscription) at any point after it begins. The client group factory only applied that update in some states, so in others the new topic was stored but never sent in a JoinGroup request and never assigned.
The update is now handled in every state the group client can be in:
doJoinGroupRequestis a no-op once the request is in flight, so the member used to sync an assignment built from stale metadata. The metadata version sent in each JoinGroup request is now tracked, and after the SyncGroup response the coordinator rejoins when that version is stale (the same rejoin as forREBALANCE_IN_PROGRESSon sync).CoordinatorClient, idle): the flush only triggered a heartbeat. It now rejoins with the updated metadata, asJoinGroupClientalready does for a flush carrying metadata.Symptom this caused in
examples/mqtt.kafka.proxy(#3290): a QoS 1 subscription opens three streams on one per-client group (messages, retained, devices). When the streams opened after the group had already joined, only the first topic was assigned. The retained stream then never completed, and live messages stayed buffered, so the subscriber got CONNACK 0 and SUBACK but no messages.Evidence, from a real single-node
apache/kafka:4.1.1with the example's exact reproduction (after one warm-up publish, which avoids the unrelated CONNACK 142 "session taken over" rejections):develophead: 8 of 39 runs had at least one QoS 1 subscriber with CONNACK 0 and 0 messages received (11 subscribers in total), while the QoS 0 subscriber on the same topic received ~186. The Kafka coordinator log showed a single JoinGroup, Sync and assignment for those groups, and temporary logging showed the update hittingCoordinatorClient(swallowed) orJoinGroupClientwith the request in flight.Not covered: the DISCONNECT 131 (0x83) variant described in the issue could not be reproduced in any run (0 in 39 before the change, 0 in 40 after), so it is not explained or verified here. Any RESET on the subscribe stream is mapped to DISCONNECT 0x83 by the MQTT server, so a group error would produce it, but that is unconfirmed.
Tests (test-first: each scenario's tests were committed and confirmed failing before its fix):
rebalance.new.topic(update after the assignment),rebalance.new.topic.before.join.group.response(update while the join is in flight, ordered with barriers) andrebalance.new.topic.before.member.assignment(update between the join response and the sync) application and network scripts, with spec-levelGroupITcases (application and network).ClientGroupITcases for all three scenarios, each confirmed failing on the previous code and passing now.ClientGroupIT,ClientGroupSaslIT,CacheGroupIT,CacheConsumerIT,CacheMergedITandCacheFetchITpass with checkstyle enabled (179 tests, 0 failures), and CI is green on the current head.Fixes #3290
🤖 Generated with Claude Code
https://claude.ai/code/session_01SiHVoXKfATu3qb7FGYa63r