Repository navigation
fix(binding-mqtt-kafka): bound the QoS 2 recovery fetch at the log end - #3156
Merged
jfallows merged 2 commits intoNov 17, 2026
Conversation
This was referenced Nov 12, 2026
Merged
jfallows
force-pushed
the
feature/mqtt-shared-subscriptions-10-recovery-fetch-bound
branch
from
November 12, 2026 21:45
3399c53 to
816b860
Compare
jfallows
force-pushed
the
feature/mqtt-shared-subscriptions-10-recovery-fetch-bound
branch
from
November 17, 2026 08:18
816b860 to
021fa00
Compare
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXHkK4X76w9XLtEXRc
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXHkK4X76w9XLtEXRc
jfallows
force-pushed
the
feature/mqtt-shared-subscriptions-10-recovery-fetch-bound
branch
from
November 17, 2026 18:36
021fa00 to
7f4f4fd
Compare
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
When a client reconnects with a restored shared subscription, a QoS 2 ticket in PUBLISH-sent state re-fetches its record by exact offset (a merged
FETCH_ONLYstream,KafkaRecoveryProxyinMqttKafkaSubscribeFactory). That fetch had nolatestOffsetbound. Reasoned from the code, a ticket offset exactly at the log end makes the fetch long-poll, and one past the end triggers the Kafka client's out-of-range reset to earliest, so the first record has a different offset and the ticket is dropped as a mismatch.This change sets
stableOffsetandlatestOffsettoKafkaOffsetType.HISTORICALon the recovery fetch partition, so the stream ends at the log end instead of waiting for new data.Pattern mirrored: the
HISTORICALmarker already used byHttpKafkaWithFetchResultand theGrpcKafkaWith*Resultclasses. InKafkaCacheClientFetchFactorya fetch carrying it ends once the cursor passes the group's latest offset, andKafkaMergedFactorytreatsHISTORICALas "end when the fetch streams end".Commits
test(binding-mqtt-kafka): all six recovery fetch scenarios now assert the bounded begin (.partition(0, 5, -2)), plus a newsubscribe.shared.recover.qos2.publish.sent.beyond.endscenario (kafka and mqtt scripts, spec ITs, runtime IT). The scenario is wire-identical to.missingapart from a log end below the ticket offset, so the real coverage is the begin assertion.fix(binding-mqtt-kafka): the two-line change innewKafkaRecoveryStream.Part of #1801
This fix is not verified end to end. The evidence is spec-level only (below). A real-broker reproduction did not reproduce the reasoned behaviour, so this PR does not claim to fix any observed stall.
Stack
Layer 10 of the stack of PRs for #1801, based on #3155 (layer 9). See #3154 for the full table.
Test evidence
MqttKafkaSubscribeProxyITfailed (timeouts and store assertion mismatches). After the fix they pass../mvnw clean install -pl specs/binding-mqtt.spec,specs/binding-mqtt-kafka.spec,runtime/binding-mqtt-kafkapasses in full on this base../mvnw checkstyle:checkis clean on both modules../mvnw clean install): BUILD SUCCESS.Real-broker reproduction (Kafka 4.1.1,
examples/mqtt.kafka.proxy, a stdlib Python MQTT 5 client)mqtt-messageswas deleted and recreated before reconnecting (log end 0, ticket offset 3). The reconnect gets session present=1, but no PUBLISH arrives within 45s on the image without this change, and none within 40s on the image with it. The behaviour is identical, so theHISTORICALbound has no observable effect here and the reasoned behaviour was not reproduced.The topic-recreate reproduction cannot put the ticket past the log end that the recovery fetch sees. The Zilla cache keeps the pre-recreate records (offsets 0-4), and the memory store is the only store here, so tickets do not survive a restart with a fresh cache. A reproduction of the target condition probably needs a persistent store. The Kafka client's out-of-range reset path was not exercised end to end. The stall seen in step 2 occurs on both images and is not attributed to this change. Its cause is still being investigated.
Generated by Claude Code