Repository navigation
fix(binding-mqtt-kafka): reset the group offsets on Clean Start when publish.qos.max is below 2 - #3273
Merged
jfallows merged 8 commits intoNov 17, 2026
Conversation
…an Start when publish.qos.max is below 2 Four existing Clean Start scenarios on a binding with publish.qos.max below 2 now expect the meta streams, FindCoordinator and OffsetDelete before the session is established, and a coordinator-not-available scenario covers a failed FindCoordinator on the same path. They fail against the current code, which never fetches the partitions on this path. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUTqxGohHBU4VramnU
…publish.qos.max is below 2 A Clean Start session on a binding with publish.qos.max below 2 now fetches the partitions of the messages and retained topics, runs FindCoordinator and OffsetDelete for the consumer group of the client, and only then replies to the client, as the QoS 2 path does. A failed reset is not retried and never fails the connect. The reset reuses the group offsets reset that runs when a session expires, including waiting for one already in progress for the same client id. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUTqxGohHBU4VramnU
…fsets reset only when it runs Resolving the messages topics of every route when a session is created fails for a route whose messages topic uses parameters, which broke sessions that never reset the group offsets. The topics are now resolved when the Clean Start reset starts, through the same helper as the QoS 2 path and the signal stream. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUTqxGohHBU4VramnU
… group offsets reset paths A route whose messages topic uses parameters cannot be resolved without a publish topic. The session expiry reset and the QoS 2 Clean Start reset throw while building the topic set for such a route. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUTqxGohHBU4VramnU
…ding the group offsets reset topics A route whose messages topic uses parameters cannot be resolved without a publish topic, so resolving it while building the topics of a group offsets reset threw. The topic set is built in one place for the session expiry reset and the Clean Start reset, and now leaves such routes out, so the group offsets of those topics are not deleted. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUTqxGohHBU4VramnU
…meterized messages topic The effective publish.qos.max is capped at 1 when a route has a parameterized messages topic, so the QoS 2 Clean Start path cannot run for such a binding. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUTqxGohHBU4VramnU
…am-credit' into fix/3205-mqtt-kafka-clean-start-qos-max
…am-credit' into fix/3205-mqtt-kafka-clean-start-qos-max
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
On Clean Start=1 the session deletes the committed offsets of the consumer group
<groupIdPrefix>-<clientId>before the new session is established (#3170, #3202), but only on the path taken whenpublish.qos.maxis 2. For a binding withpublish.qos.maxbelow 2 the session never fetched the partitions, so OffsetDelete had nothing to name and a client that connected with Clean Start=1 was still sent the backlog of its previous session.A Clean Start on a binding with
publish.qos.maxbelow 2 now fetches the partitions of the messages and retained topics, runs FindCoordinator and OffsetDelete for the group of the client, and only then replies to the client, as the QoS 2 path does. A failed reset is not retried and never fails the connect. The reset reuses the group offsets reset that runs when a session expires (#3204), including waiting for one already in progress for the same client id.This adds latency to a Clean Start connect when
publish.qos.maxis below 2: the reply to the client waits for the partition lookup, FindCoordinator and OffsetDelete.Stacked on #3272 (base
fix/3271-mqtt-kafka-request-stream-credit), which is stacked on #3267.Fixes #3205
Specification statements
Read in full: MQTT v5.0 3.1.2.4 and 4.1 (with 4.1.1), MQTT v3.1.1 3.1.2.4, and the Kafka protocol definitions of OffsetDelete (key 47, v0) and FindCoordinator (key 10, v3). Not read in full: the rest of both MQTT specifications, the rest of the Kafka protocol page, and the diff of #3202.
group_id [topics => name [partitions => partition_index]], so the partitions must be named.The discard obligation does not depend on
publish.qos.max, so the reset is needed on this path as well.Changes
publish.qos.maxbelow 2 registers a group offsets reset for the client id, waits for it (the existingawaitedResetwait), and then starts the session, so the reply to the client follows the OffsetDelete.KafkaGroupOffsetsReset,groupOffsetsResetsandawaitedReset. The reset is created through a newnewGroupOffsetsResethelper, which the session expiry reset now also uses, anddoOpenMetastakes the authorization of the session (the expiry reset passes 0 as before).resolveMessagesTopics, used by the session expiry reset, the QoS 2 Clean Start and the below-2 Clean Start. It leaves out routes whose messages topic is parameterized, which cannot be resolved without a publish topic and previously made the build of the topic set throw. This was shown on the wire for the session expiry reset and the below-2 path before the guard (shouldResetGroupOffsetsOnSessionExpiryWhenMessagesWithParams,shouldRejectPublishWhenTopicSpaceWithParams). The QoS 2 Clean Start path cannot run for such a binding, because the effectivepublish.qos.maxis capped at 1 when a route has a parameterized messages topic, so nothing changed there beyond using the helper.Tests
First commit (failing): the four existing Clean Start scenarios on the below-2 path now expect the meta streams, FindCoordinator and OffsetDelete:
session.close.reconnect.clean.start,session.will.message.clean.start,session.will.message.clean.start.abort.zero.windowandpublish.reject.qos2(with theat_least_onceconfig), plus a new coordinator-not-available scenario (session.clean.start.qos.max.1withsession.clean.start.reset.group.offsets.coordinator.not.available.qos.max.1). All five failed against the previous code because the scripted meta streams were never opened. They are in the existing IT classes (KafkaIT,MqttIT,MqttKafkaSessionProxyIT); no new IT class.session.will.message.clean.start.abort.zero.windowgrants every kafka stream a window of 67, which is smaller than the OffsetDelete request, so it stayed red until #3272 made the request wait for credit. It is unchanged from the first commit and passes with #3272 merged.Result of a clean
verifyof the touched modules with module checks on and the build cache skipped, with #3272 merged:specs/binding-mqtt-kafka.spec:MqttIT130 tests,KafkaIT163 tests, 0 failures, 0 checkstyle violations.runtime/binding-mqtt-kafka: 169 tests (MqttKafkaSessionProxyIT54,MqttKafkaPublishProxyIT45,MqttKafkaSubscribeProxyIT70, unit tests 10), 0 failures, 0 checkstyle violations.Not delivered
Generated by Claude Code