You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "sun-9545sunoj (via GitHub)" <gi...@apache.org> on 2026/09/16 06:06:23 UTC
[PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
sun-9545sunoj opened a new pull request, #12340:
URL: https://github.com/apache/seatunnel/pull/12340
### Purpose of this pull request
This PR fixes a critical bug where RocketMqAdminUtil.currentOffsets treats a transient metadata
lookup failure as proof that a consumer group has committed nothing, causing the connector to
silently rewind and re-deliver the entire topic when start.mode = CONSUME_FROM_GROUP_OFFSETS.
The Issue:
When adminClient.examineConsumeStats attempts to look up consumer group offsets and the name
server temporarily has no route for the group (e.g., the %RETRY%GroupName topic), it throws an
MQClientException with ResponseCode.TOPIC_NOT_EXIST. The connector was unconditionally catching
this and returning an empty map. Because the core topic itself genuinely exists, the subsequent
listOffsets call succeeds, setting the start offset to 0 and silently rewinding the consumer.
The Fix:
Inside RocketMqAdminUtil.currentOffsets, we now catch the MQClientException for each topic. If a
TOPIC_NOT_EXIST error is encountered, we explicitly check if the main topic actually exists using
topicExist(config, topic).
• If topicExist is true, the failure is a transient consumer group metadata lookup failure, so we
throw the RocketMqConnectorException to fail fast (and allow the engine to retry).
• If topicExist is false, the topic genuinely does not exist, so we safely return an empty map as
before.
(Resolves #12332)
### Does this PR introduce any user-facing change?
No. This restores the intended behavior of CONSUME_FROM_GROUP_OFFSETS by preventing silent data
re-delivery during transient name server route unavailability.
### How was this patch tested?
The defect was established by logic and by CI logs demonstrating that transient route
unavailability drops name server responses for minutes at a time. The fix was tested locally to
ensure that if a topic physically exists (topicExist == true), the connector will correctly throw
a GET_CONSUMER_GROUP_OFFSETS_ERROR instead of returning Collections.emptyMap().
### Check list
[✓] If any new Jar binary package adding in your PR, please add License Notice according New
License Guide https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md (N/A -
no new dependencies)
[✓] If necessary, please update the documentation to describe the new feature. (N/A - bug fix)
[✓] If necessary, please update incompatible-changes.md to describe the incompatibility caused by
this PR. (N/A - behavior restored, no config changes)
[✓] If you are contributing the connector code, please check that the following files are
updated:
1. Update plugin-mapping.properties and add new connector information in it (N/A - existing
connector)
2. Update the pom file of seatunnel-dist (N/A)
3. Add ci label in label-scope-conf (N/A)
4. Add e2e testcase in seatunnel-e2e (N/A - transient name server lookup failures are
difficult to simulate in standard E2E containers)
5. Update connector plugin_config (N/A)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #12340:
URL: https://github.com/apache/seatunnel/pull/12340#discussion_r4022998314
##########
seatunnel-connectors-v2/connector-rocketmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rocketmq/common/RocketMqAdminUtil.java:
##########
@@ -284,9 +283,24 @@ public static Map<MessageQueue, Long> currentOffsets(
adminClient = RocketMqAdminUtil.startMQAdminTool(config);
Map<MessageQueue, OffsetWrapper> consumerOffsets = Maps.newConcurrentMap();
for (String topic : topics) {
- ConsumeStats consumeStats =
- adminClient.examineConsumeStats(config.getGroupId(), topic);
- consumerOffsets.putAll(consumeStats.getOffsetTable());
+ try {
+ ConsumeStats consumeStats =
+ adminClient.examineConsumeStats(config.getGroupId(), topic);
+ consumerOffsets.putAll(consumeStats.getOffsetTable());
+ } catch (MQClientException e) {
+ if (e.getResponseCode() == ResponseCode.TOPIC_NOT_EXIST) {
+ if (topicExist(config, topic)) {
+ throw new RocketMqConnectorException(
+ RocketMqConnectorErrorCode.GET_CONSUMER_GROUP_OFFSETS_ERROR, e);
+ }
Review Comment:
`topicExist` cannot distinguish the transient case this change is intended to handle: it calls `examineTopicRouteInfo` and maps the same `TOPIC_NOT_EXIST` response code to `false` at `RocketMqAdminUtil.java:190-198`. If the main topic's route is also temporarily unavailable, this branch still falls through and returns an empty map, so the caller can still interpret the lookup failure as "no committed offsets" and start from the first offset. Please avoid using this boolean re-check as proof of nonexistence; retry or propagate an unknown result instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
Posted by "sun-9545sunoj (via GitHub)" <gi...@apache.org>.
sun-9545sunoj closed pull request #12340: [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures
URL: https://github.com/apache/seatunnel/pull/12340
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
Posted by "sun-9545sunoj (via GitHub)" <gi...@apache.org>.
sun-9545sunoj commented on PR #12340:
URL: https://github.com/apache/seatunnel/pull/12340#issuecomment-5790035973
Thanks for your time reviewing this! Considering the overlap and conflicts with the fix merged in #12349, I've decided to close this PR. I look forward to contributing to other issues.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12340:
URL: https://github.com/apache/seatunnel/pull/12340#issuecomment-5696341735
Good job.
Thanks a lot for your valuable contribution to Apache SeaTunnel!
To pass the automated CI checks for this PR, could you please enable CI workflows in your forked repository first? You can refer to the check run link below as a reference for the required CI configuration: https://github.com/apache/seatunnel/runs/104752283889
If you run into any trouble enabling CI or encounter related errors during the process, feel free to leave a comment here. Contributors are always ready to offer help~
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
Posted by "sun-9545sunoj (via GitHub)" <gi...@apache.org>.
sun-9545sunoj commented on PR #12340:
URL: https://github.com/apache/seatunnel/pull/12340#issuecomment-5757361198
Thanks for the detailed review and for pointing out PR #12349!
I've taken a close look at how PR #12349 solves the issue. Their approach of using topicRouteAvailable to distinguish between a genuinely unprovisioned consumer group and a missing route is a great, precise solution. However, if used alone, it will still instantly throw an exception and fail the job if the name server is experiencing a transient route propagation delay (i.e., if both routes are temporarily missing).
To get the best of both worlds, I've rebased on the latest dev branch (which now includes PR #12349) and updated this PR to use a hybrid approach:
1. When examineConsumeStats throws TOPIC_NOT_EXIST, we now check topicRouteAvailable(adminClient, topic) just as PR #12349 does.
2. If the business topic route is healthy, we know the group is genuinely new/unprovisioned. We immediately fall back to the start offset (returning an empty map) without retrying.
3. If both routes are missing, indicating a true transient name server blip, we invoke the RetryUtils bounded backoff loop. This gracefully smooths over the transient delay instead of immediately failing the job.
I've also resolved all the merge conflicts, updated the tests to cover the hybrid logic, and applied spotless formatting.
Let me know if this hybrid approach looks good for merging!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Connector-V2] Fix RocketMQ silent rewind on transient consumer group metadata lookup failures [seatunnel]
Posted by "sun-9545sunoj (via GitHub)" <gi...@apache.org>.
sun-9545sunoj commented on PR #12340:
URL: https://github.com/apache/seatunnel/pull/12340#issuecomment-5708802532
Thanks so much for the thorough review and for decompiling the client to trace the %RETRY%GroupName behavior! You are completely right about the autoCreateSubscriptionGroup=false edge case.
I've updated the PR to address all your blocking and minor points:
1. Transient vs Permanent (Bounded Retry): I removed the faulty topicExist check. Instead, I added a bounded retry loop directly around examineConsumeStats for TOPIC_NOT_EXIST. It will retry up to 3 times
(with 1s, 2s, and 3s backoffs) to smooth over genuine name-server propagation delays. If it still fails, it propagates the error. This prevents the crash-loop for temporary blips, but correctly fails for
unprovisioned subscription groups.
2. Clearer Error Message: If the retry budget is exhausted, the exception is now wrapped with a highly specific message explicitly mentioning: "Consumer group offset lookup failed for topic '%s' because
route info for the group could not be resolved (transient name server delay or subscription group not provisioned).". This should make triage instant for operators hitting the
autoCreateSubscriptionGroup=false case (ROCKETMQ-09).
3. Test Coverage:
• Added RocketMqAdminUtilTest which mocks the underlying DefaultMQAdminExt to verify the retry backoff and the final exception structure.
• Extended RocketMqSourceSplitEnumeratorTest with testRun_propagatesExceptionWhenGroupOffsetsLookupFails, proving that when the admin util throws, the enumerator run() correctly propagates the failure
instead of falling back to the first offset.
Let me know if this looks good to you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org