Skip to content

[Fix][E2E] Retry and route-guard the remaining RocketMqIT offset reads - #12392

Merged
nzw921rx merged 1 commit into
apache:devfrom
SEPURI-SAI-KRISHNA:fix-rocketmq-e2e-helper-hardening
Sep 21, 2026
Merged

nzw921rx merged 1 commit into
apache:devfrom
SEPURI-SAI-KRISHNA:fix-rocketmq-e2e-helper-hardening

Conversation

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Collaborator

Purpose of this pull request

This is the follow-up I committed to on #12323, which fixes the two remaining gaps I found while sweeping that file and deliberately kept out of that PR to keep its scope tight. Both were listed there as points 2 and 3, and @DanielLeens recorded them as non-blocking in his review.

currentOffsets was not retry-wrapped while its neighbour was. In getRocketMqConsumerData, the offsetTopics lookup is wrapped in RetryUtils.retryWithException, and the currentOffsets call immediately below it was not, although both read broker metadata that can be briefly unavailable. They now use the same RetryMaterial.

This matters more since #12349. There, RocketMqAdminUtil.currentOffsets stops reporting a failed lookup as an empty map and surfaces it as RocketMqConnectorException instead. That is the right behaviour for the production caller, but it means an unwrapped call here fails the test where the wrapped neighbour one line up would have retried. The RetryMaterial already in place retries exactly exception instanceof RocketMqConnectorException, so this is the consistent spelling rather than a new policy.

checkOffsetNoDiff has the tightest window in the file. It reads offsetTopics and then currentOffsets under Awaitility with a 30 second ceiling. Every other window in this file is 60 seconds or longer, up to 5 minutes, and while working on #12322 I measured a name server route gap that lasted 4 minutes 24 seconds. A gap of that size fails this check.

The fix confirms the route before entering the window rather than widening it, using the waitForTopicRoute helper already in the file. That follows the approach #12323 established, and keeps the assertion window itself tight so a genuine offset mismatch still fails fast.

I want to be precise about the evidence for each, as I was on #12323.

The checkOffsetNoDiff window is latent rather than demonstrated: testSourceRocketMqTextToConsoleWithOffsetCheck did not fail once across the 12 daily Schedule Backend runs I sampled for #12322. That is why it was not folded into #12323.

The currentOffsets call has been seen failing tests, but I do not want to claim it as evidence for a retry, because it is not. On the first commit of #12349, before that PR was corrected, testSinkRocketMq failed 7 of 7 at getRocketMqConsumerData with ROCKETMQ-09. The cause there was the never-created %RETRY% topic, which is a standing condition rather than a transient one, so a retry would only have delayed the same failure. #12349 fixes that cause directly. What this change covers is the genuinely transient case, and that has not been separately demonstrated on this call. It is a consistency fix with a plausible benefit, not a fix for an observed failure.

Does this PR introduce any user-facing change?

No. Test-only, in a single E2E class. No production code, config option, or documented behaviour is touched.

How was this patch tested?

./mvnw -q -DskipTests verify -pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-rocketmq-e2e on JDK 11 passes, which covers the enforcer checks, spotless:check and compilation. spotless:check was also run separately with up-to-date caching disabled.

No new test is added, and this is the case the test-class convention is about: the change is to RocketMqIT itself, so the IT is both the thing being changed and the coverage. The rocketmq-connector-it legs on this PR's own CI exercise both paths: getRocketMqConsumerData is reached from testSinkRocketMq, testTextFormatSinkRocketMq and testSinkRocketMqMessageTag, and checkOffsetNoDiff from testSourceRocketMqTextToConsoleWithOffsetCheck.

@DanielLeens DanielLeens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SEPURI-SAI-KRISHNA, thank you for the follow-up, and for keeping this scoped to the two items we recorded as non-blocking on #12323. The PR body is unusually honest about what is demonstrated and what is only latent, which made this much easier to review. I read the whole diff against the current dev, walked every offset read and every topic-creating call in RocketMqIT at the head commit, and cross-checked the two sibling PRs. I found no blocking issue. I do have a few precision points that I think are worth fixing while you are in here, mostly about comments that claim slightly more than the code delivers.

What Problem Does This PR Solve?

Two small robustness gaps in RocketMqIT (test-only, one file):

  1. In getRocketMqConsumerData, the offsetTopics lookup is wrapped in RetryUtils.retryWithException but the currentOffsets call right below it is not.
  2. checkOffsetNoDiff reads broker metadata under a 30 second Awaitility window, the tightest window in the file, with no route confirmation first.

Before: an unwrapped currentOffsets call fails the test on the first RocketMqConnectorException, and checkOffsetNoDiff starts its 30 second clock without knowing whether the topic route is visible.
After: currentOffsets gets the same RetryMaterial as its neighbour, and checkOffsetNoDiff calls the existing waitForTopicRoute(topicName) before entering the window.

1. Code Change Review

1.1 Core Logic Analysis

Two hunks, both in seatunnel-e2e/seatunnel-connector-v2-e2e/connector-rocketmq-e2e/src/test/java/org/apache/seatunnel/e2e/connector/rocketmq/RocketMqIT.java:

Hunk 1, getRocketMqConsumerData (lines 536-550 at head):

// before
Map<MessageQueue, Long> currentOffsets =
        RocketMqAdminUtil.currentOffsets(newConfiguration(), Lists.newArrayList(topicName), queueOffsets.keySet());
// after
Map<MessageQueue, Long> currentOffsets =
        RetryUtils.retryWithException(
                () -> RocketMqAdminUtil.currentOffsets(newConfiguration(), Lists.newArrayList(topicName), queueOffsets.keySet()),
                new RetryUtils.RetryMaterial(Constant.OPERATION_RETRY_TIME, false,
                        exception -> exception instanceof RocketMqConnectorException, Constant.OPERATION_RETRY_SLEEP));

Hunk 2, checkOffsetNoDiff (line 638): one added waitForTopicRoute(topicName); before the Awaitility.await() block. The 30 second window itself is unchanged.

Key findings:

  • The retry is bounded: Constant.OPERATION_RETRY_TIME = 30 and OPERATION_RETRY_SLEEP = 2000 (seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/Constant.java:40-42), so at most 30 attempts with a fixed 2 second backoff, roughly 60 seconds of sleep plus per-call time. No unbounded loop, no hard Thread.sleep in test code.
  • The retry predicate is narrow (RocketMqConnectorException only), which is the right exception for RocketMqAdminUtil.currentOffsets (seatunnel-connectors-v2/connector-rocketmq/src/main/java/org/apache/seatunnel/connectors/seatunnel/rocketmq/common/RocketMqAdminUtil.java:298-312).
  • The route guard reuses the existing helper and is idempotent for an already-created topic. waitForTopicRoute is already used after jobs stop in the restore test (RocketMqIT.java:775, :795-796), so calling it after the job in checkOffsetNoDiff follows an established pattern and does not touch consumer offsets.
  • On the normal user path: this is test-only, so no production path is touched. Within the test, both hunks run on the mainline path of testSinkRocketMq, testTextFormatSinkRocketMq, testSinkRocketMqMessageTag and testSourceRocketMqTextToConsoleWithOffsetCheck, not only on a recovery path.
  • Correctness caveats are in Issues 1 to 3 below: what happens when the retry is exhausted, what the retry can actually catch on today's dev, and which route the new guard really confirms.

Runtime path (retry hunk), as it behaves on the reviewed base:

getRocketMqConsumerData(topic)
  -> offsetTopics(...)  [retry, RocketMqConnectorException only]
  -> currentOffsets(...) [now the same retry]
       RocketMqAdminUtil.currentOffsets -> examineConsumeStats(group, topic)
         MQClientException TOPIC_NOT_EXIST -> returns emptyMap (NOT retried, RocketMqAdminUtil.java:302-305)
         other MQClientException/Remoting/Broker/Interrupted -> RocketMqConnectorException -> retried
  -> retries exhausted with shouldThrowException=false -> RetryUtils returns null (RetryUtils.java:74-79)
  -> currentOffsets.containsKey(mq) NPE (RocketMqIT.java:553) -> catch (Exception) -> RuntimeException(NPE) (RocketMqIT.java:582-583)

1.2 Compatibility Impact

Fully compatible. Test-only change in one E2E class; no production code, options, defaults, SPI or docs are touched. I checked the merge with the two sibling PRs (see 3.2): no textual conflict.

1.3 Performance / Side-Effect Analysis

  • Worst-case added test time is bounded: retry at most about 60 seconds of backoff plus call time, and the route guard at most 1 minute (RocketMqIT.java:487). Neither fires on a healthy broker.
  • Each retry attempt starts and shuts down its own admin client inside RocketMqAdminUtil.currentOffsets (finally at RocketMqAdminUtil.java:313-317), so no client leaks across attempts.
  • waitForTopicRoute issues producer.createTopic(...) on an existing topic with the same queue count it was created with. That is idempotent and does not reset committed offsets; it is the same call the restore test already makes after the job stops.

1.4 Error Handling and Logging

Issue 1: Retry exhaustion turns the real failure into a bare NullPointerException

  • Location: RocketMqIT.java:539-550 (new), same pattern already at :524-534 and :873-883; behaviour defined in seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/RetryUtils.java:51-56 and :74-79
  • Problem description: the new call passes shouldThrowException = false. In RetryUtils.retryWithException, when all attempts fail and that flag is false, the method returns null and drops the last exception. Here that null is dereferenced at RocketMqIT.java:553 (currentOffsets.containsKey(mq)), and the surrounding catch (Exception ex) at :582-583 rethrows it as RuntimeException(NullPointerException). The diagnostic that would have told a maintainer what actually failed (the RocketMqConnectorException and its cause) is discarded. The same flag also means a non-retriable exception (predicate false) is not rethrown; RetryUtils.java:51-55 simply falls through and the loop re-executes it immediately, up to 30 times with no sleep, before returning null.
  • Potential risk: this cannot turn a real failure into a pass, so it is not a correctness hole. But it converts an immediately readable failure into a roughly 60 second stall followed by an opaque NPE, which is exactly what makes a flaky E2E expensive to triage in CI logs.
  • Best improvement: for the new call, pass true for shouldThrowException. RetryUtils.java:52-54 then rethrows a non-retriable exception at once and :74-78 throws with the last exception as the cause after exhaustion. Ideally apply the same one-word change to the neighbouring offsetTopics retry at :530-534 (and :879-883) so the three copies stay consistent, or leave those two untouched and mention it in the description.
  • Severity: Medium
  • Raised by another reviewer: No

Issue 2: The comment and PR text state as fact a behaviour that is not on dev yet

  • Location: RocketMqIT.java:536-538; PR description ("This matters more since #12349")
  • Problem description: the new comment says currentOffsets "now surfaces such a failure as RocketMqConnectorException rather than an empty map". On the reviewed base that is not true. RocketMqAdminUtil.java:302-305 still returns Collections.emptyMap() for ResponseCode.TOPIC_NOT_EXIST, and #12349, which changes that, is still open and unmerged. The route-gap error you are worried about (the name server has no route, code 17) therefore comes back as an empty map today, is not an exception, and is not retried by this wrapper. The retry as written can only catch the other failure classes (broker, remoting, timeout, interrupted) until #12349 lands.
  • Potential risk: a future reader trusts the comment, believes route gaps are covered by this retry, and either removes a needed guard or misdiagnoses a failure. It also means the practical benefit of hunk 1 depends on merge order, which the description does not state precisely.
  • Best improvement: reword the comment to what is true on dev, for example "retried on the same terms as the offsetTopics lookup above; a lookup failure that surfaces as RocketMqConnectorException is retried", and avoid citing a PR number in code. In the PR description, state that the retry only covers route gaps once #12349 is merged, and note the merge-order dependency (merging this first is harmless, it is just a partial no-op for that case).
  • Severity: Medium
  • Raised by another reviewer: No

Issue 3: The new route guard confirms the wrong route for currentOffsets, and its ceiling is shorter than the gap it cites

  • Location: RocketMqIT.java:635-638 (new comment and call), waitForTopicRoute at :484-513 (ceiling at :487), currentOffsets read at :650-652
  • Problem description: two related points.
    • (a) waitForTopicRoute(topicName) proves the route of topicName is visible, which is what RocketMqAdminUtil.offsetTopics needs (examineTopicStats(topic) resolves topic). But RocketMqAdminUtil.currentOffsets calls examineConsumeStats(groupId, topic), and in rocketmq-tools 4.9.4 that method resolves its route from the group's retry topic, not from the requested topic: DefaultMQAdminExtImpl.examineConsumeStats does MixAll.getRetryTopic(consumerGroup) then examineTopicRouteInfo(retryTopic) (I read this in the 4.9.4 sources jar; I did not run it). So for checkOffsetNoDiff's group (SeaTunnel-Consumer-Group) the guard does not confirm the %RETRY%SeaTunnel-Consumer-Group route. As I read RocketMqAdminUtil.java:302-305, a missing retry-topic route on dev (code 17) yields an empty map, so consumeOffset is null and the assertion inside the 30 second window fails repeatedly until it times out, which is the same tight window as before. The comment "Both reads below need a resolvable topic route" is therefore only accurate for the first read.
    • (b) The stated motivation is a 4 minute 24 second route gap. waitForTopicRoute itself has a 1 minute ceiling (:487), so for a gap of that size the guard times out after 60 seconds instead of the assertion timing out after 30. It helps gaps between 30 and 60 seconds and leaves the cited case failing, just later. The PR body correctly says this window is "latent rather than demonstrated", so I do not think this is worth blocking, but the comment and description should not imply the 4m24s case is now handled.
  • Potential risk: residual flakiness in testSourceRocketMqTextToConsoleWithOffsetCheck that looks fixed but is only partly mitigated, and a guard that reads as more protective than it is.
  • Best improvement: pick one of these. (1) Keep the guard but make the comment precise: it confirms the topic route for the offsetTopics read only. (2) Widen the checkOffsetNoDiff window from 30 to 60 seconds, consistent with waitConsumedOffsetsSynced at :604-606, whose comment at :598-603 records exactly this kind of CI-load overrun; the description argued against widening to keep a genuine mismatch failing fast, but a mismatch fails identically at 60 seconds, only later. (3) Additionally wait until the group's retry-topic route resolves before asserting. Option 1 alone is acceptable for this PR.
  • Severity: Medium
  • Raised by another reviewer: No

Issue 4: One sink test that reads through getRocketMqConsumerData still has no route guard

  • Location: RocketMqIT.java:413-429 (testSinkRocketMqMessageTag); compare :192 and :211
  • Problem description: testSinkRocketMq and testTextFormatSinkRocketMq call waitForTopicRoute for their sink topic before the job runs. testSinkRocketMqMessageTag sinks to test_topic_message_tag (rocketmq-sink_fake_to_rocketmq_message_tag.conf, topic = "test_topic_message_tag") and then reads it back through the same getRocketMqConsumerData, which the PR description explicitly lists as an exercised path, but it has no guard. This gap is pre-existing on dev and outside this diff, and I have no CI evidence that it fails today. It is included because the PR title is "the remaining ... offset reads", so this is one of the remaining sites. The same applies, more weakly, to sinkTopic in the restore test: only sourceTopic is warmed before the first job starts (:706 vs the job launch at :715); sinkTopic is only warmed later at :796.
  • Potential risk: the same "No topic route info in name server" class that #12115 and #12323 addressed for the other sink tests.
  • Best improvement: add waitForTopicRoute("test_topic_message_tag"); at the top of testSinkRocketMqMessageTag, matching its two siblings. Optional and small; feel free to defer the restore-test observation.
  • Severity: Medium
  • Raised by another reviewer: No

Coverage matrix I checked at head (every topic-creating or route-sensitive site in RocketMqIT):

Site Guard
startUp -> generateTestData("test_topic_source") guarded inside generateTestData (:453)
All generateTestData callers (text tag, error tag, text, offset check, json, multi-table A and B, start config) guarded via :453
testSinkRocketMq, testTextFormatSinkRocketMq :192, :211
testSinkRocketMqMessageTag none (Issue 4)
latest / earliest / specific offsets / timestamp source tests :358, :368, :378, :388
testSourceRocketMqRestore source topic (initial, additional, restore sends) and restore :706, :736, :775, :795; sink topic before restore :796; sink topic before first job: none
getRocketMqConsumerData offset reads retry-wrapped (:524-550); no explicit route guard
waitConsumedOffsetsSynced Awaitility 60s with ignoreExceptions (:604-606)
checkOffsetNoDiff Awaitility 30s plus new guard (:638-641), see Issue 3
pollMessagesFromOffset, getTopicMaxOffset retry-wrapped (:873-883, :939-947)

2. Code Quality Assessment

2.1 Coding Standards

  • The added comments explain why, not what, and the changes are minimal and focused. No wildcard imports, no unrelated edits.
  • Comment accuracy is the only problem: see Issue 2 and Issue 3(a). No new non-trivial methods or fields are introduced, so no missing-comment issue.

2.2 Test Coverage and Test Stability

Stability rating: Risk present.

Evidence:

  • Positive: no hard Thread.sleep in test code; both new waits are condition-based (waitForTopicRoute uses Awaitility with a 1 second poll, RocketMqIT.java:485-489; the retry has a bounded attempt count). No new fixed ports, static state or unreleased resources; the container and producer lifecycle is untouched (:143-188).
  • Residual risk: the checkOffsetNoDiff window is still 30 seconds (:641) and the new guard does not confirm the retry-topic route that currentOffsets resolves (Issue 3). The retry wrapper will fail with an opaque NPE after exhaustion (Issue 1). Neither can make a real failure pass.
  • Not-a-masking check: the retry predicate catches only RocketMqConnectorException, and the loop cannot convert a failure into a pass, so a genuine offset mismatch still fails. The assertions in checkOffsetNoDiff and waitConsumedOffsetsSynced are unchanged, so test strictness is not weakened.
  • Test-convention: no new test class, and the change is to RocketMqIT itself, so extending the existing IT is the right call.

What I could and could not verify: I read the code at the head commit, the local 4.9.4 client sources, and the fork's CI results for this exact head. I did not run the tests, and I cannot verify from source alone whether a name-server route gap actually reaches currentOffsets on the retry-topic path in CI; the 4m24s figure comes from the description and I have not independently confirmed it.

2.3 Documentation Updates

Not applicable: no user-visible change, no docs impact (docs/en and docs/zh unaffected).

3. Architectural Soundness

3.1 Elegance of the Solution

Temporary workaround, in the good sense for an E2E hardening: it reuses RetryMaterial and waitForTopicRoute already established in this class rather than adding a new mechanism. It is not a root-cause fix of route-propagation latency, which is not fixable from the test side. The root-cause-side change belongs to #12349 (production behaviour of currentOffsets), and this PR's retry benefit is contingent on it (Issue 2).

3.2 Maintainability

Good, with one caveat: a fourth near-identical RetryMaterial block now exists (:530-534, :546-550, :879-883, and :943-947, which differs only in using true and an always-true predicate). A tiny private helper would remove the duplication, but that is optional and I would not ask for it in this PR.

Sibling PR overlap check (read-only):

  • #12393 ("Make RocketMqIT.deleteTopicIfExist actually delete the topic", open, same author): its hunks are the QueueData to BrokerData import (:54) and deleteTopicIfExist (:961-1001). This PR touches :533-550 and :632-640 only. I ran a three-way merge of the two heads against the shared base and got zero conflict markers, so there is no merge-conflict and no double-fix. They are independent.
  • Interaction worth knowing: once #12393 makes deleteTopicIfExist really delete, the delete-then-generateTestData flow in the tag tests relies on waitForTopicRoute inside generateTestData (:453) to recreate the route; that guard already exists on dev, so nothing in this PR needs to change.
  • #12323 (merged 2026-09-19): this PR builds directly on it and does not undo any of it; waitForTopicRoute and all its earlier call sites are untouched.
  • #12349 (open, unmerged): the semantic dependency described in Issue 2.

3.3 Extensibility

Neutral. Adding a route guard to testSinkRocketMqMessageTag (Issue 4) would make the class uniformly "guard before any topic use", which is easier to keep true as new tests are added.

3.4 Historical-Version Compatibility

Fully compatible. Test-only, no serialized state, checkpoint, configuration or option changes. The 2.6-release to 3.0-test upgrade path is not touched (this is an upstream apache/seatunnel PR against dev).

4. Issue Summary

Number Issue Location Severity
1 Retry exhaustion with shouldThrowException=false returns null and surfaces as a bare NPE, discarding the real cause RocketMqIT.java:539-550, RetryUtils.java:51-56, :74-79 Medium
2 Comment and description say currentOffsets already surfaces failures as exceptions; on dev it still returns an empty map for route gaps (RocketMqAdminUtil.java:302-305), so the retry depends on unmerged #12349 RocketMqIT.java:536-538 Medium
3 New guard confirms the topic route, not the retry-topic route currentOffsets resolves; its 1 minute ceiling is also shorter than the 4m24s gap cited RocketMqIT.java:635-638, :484-487, :650-652 Medium
4 testSinkRocketMqMessageTag (and restore sinkTopic before the first job) still has no route guard, unlike sibling sink tests RocketMqIT.java:413-429, :706-715 Medium

5. Merge Recommendation

Conclusion: Ready to merge

Blockers - must be fixed

  • None. No High issue and no compatibility concern.

Recommended fixes - non-blocking

  • Issue 1: pass true for shouldThrowException on the new currentOffsets retry so a genuine failure keeps its cause.
  • Issue 2: correct the comment at RocketMqIT.java:536-538 and the PR description so they only claim what is true on dev, and state the merge-order relationship with #12349.
  • Issue 3: make the guard comment precise (it confirms the topic route for the offsetTopics read), and consider widening the checkOffsetNoDiff window to 60 seconds for parity with waitConsumedOffsetsSynced.
  • Issue 4: add waitForTopicRoute("test_topic_message_tag"); to testSinkRocketMqMessageTag.

Overall assessment: a small, well-scoped, well-described hardening. The change is safe (bounded retries, narrow predicate, no weakened assertions, no production code), and the description's candour about the evidence is exactly the right habit. My recommendations are about making the comments match what the code does and closing the last unguarded sink test. Better-alternative note: the durable fix for the retry-topic route question is the production change in #12349, which this test change only complements.

CI: for head 42e8fa6, the apache-side Build check is completed / success, and it points at the fork's Build workflow run, which I read: status completed, conclusion success, event push, head SHA equal to this PR's head. In that run both rocketmq-connector-it (8, ubuntu-latest) and rocketmq-connector-it (11, ubuntu-latest) are success; the remaining jobs are success or skipped (for example the website and UI jobs), with no failures. Notify test workflow and labeler are also success. Note that a green run shows the change compiles and these paths passed at least once; it does not by itself demonstrate the latent route-gap scenarios discussed above. GitHub reports the merge state as blocked; I read that as the pending approving review (this is my inference, I did not check the branch-protection rules).

🤖 Generated with Claude Code

Follow-up to apache#12323 for the two gaps flagged there but deliberately left out
of that PR's scope.

getRocketMqConsumerData retry-wrapped its offsetTopics lookup but not the
currentOffsets call immediately below it, although both read broker metadata
that can be briefly unavailable. The two now use the same RetryMaterial.

checkOffsetNoDiff reads offsetTopics and currentOffsets under the tightest
Awaitility window in the file, 30 seconds, against a route gap measured at
4m24s in CI. It now confirms the topic route before entering that window
rather than widening it, which is the approach apache#12323 established.
@SEPURI-SAI-KRISHNA
SEPURI-SAI-KRISHNA force-pushed the fix-rocketmq-e2e-helper-hardening branch from 42e8fa6 to 1b522ac Compare September 20, 2026 12:31
@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Collaborator Author

All four addressed. Thank you for these, particularly Issue 3, which is my own finding from #12332 applied back to my own change and I did not spot it.

Issue 1. shouldThrowException is now true on the currentOffsets retry. You are right about the consequence: RetryUtils returns null at RetryUtils.java:79 once retries are exhausted with false, and RocketMqIT.java:557 then does currentOffsets.containsKey(mq), so a genuine failure would have surfaced as a bare NPE with lastException discarded. Reading that method again, false costs a second thing you did not mention: at RetryUtils.java:51-54 an exception the predicate rejects is swallowed rather than rethrown, so a non-retriable failure quietly burns the remaining attempts and also ends at that null. true fixes both. The comment now says why this call differs from its neighbour.

I have deliberately not changed the offsetTopics retry above it, which has the same property: exhaustion there returns null and consumer.assign(null) follows. That one is pre-existing rather than introduced here, and widening this PR to cover it felt like the wrong trade. Say the word if you would rather it went in too.

Issue 2. Corrected. The comment claimed currentOffsets already raises RocketMqConnectorException, which is only true after #12349. It now says that on dev the call still maps a failed lookup onto an empty map, that the wrapper is a consistency fix today, and that it becomes load bearing once #12349 merges.

Issue 3. Corrected, though I have reached a different conclusion on the second half and want to explain rather than quietly diverge.

You are right that the guard confirms this topic's route while currentOffsets resolves %RETRY%<group>. I think it still covers that read, for a reason the old comment did not give: the name server drops routes per broker rather than per topic, so a resolvable route for the data topic means the broker registration is live and the retry topic's route with it. The retry topic exists by that point because the job has already consumed with that group. The comment now states exactly that, and says plainly that it is a short-gap guard, since waitForTopicRoute gives up after a minute and the 4m24s outage would still fail, only with a route message rather than an opaque assertion timeout.

On widening checkOffsetNoDiff to 60 seconds, I would rather not. Neither 30 nor 60 seconds survives a multi-minute gap, so the widening buys no real resilience, and keeping the window tight means a genuine offset mismatch still fails fast. It is also the opposite of the position I argued on #12323 and you accepted there, that we remove causes rather than widen windows. Happy to be overruled if you see it differently.

Issue 4. waitForTopicRoute("test_topic_message_tag") added to testSinkRocketMqMessageTag before the read, matching the sibling sink tests.

Verified locally: verify passes on JDK 11, and spotless:check separately with up-to-date caching disabled. The branch is rebased onto current dev, so it now sits on top of #12393, #12395 and #12396.

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Collaborator Author

@nzw921rx heads up on an overlap: this PR and your #12350 both edit RocketMqIT.java, so whichever lands second will need a rebase.

This one is +30/-5 on that file, approved, CI green. #12350 is +51/-59 and currently conflicts with dev, probably from #12323, #12393 and #12396 landing in that file after it was opened. The two do not overlap in intent, since this change only wraps the remaining offset reads in the retry and route guard that are already in the file. If you would rather land #12350 first, I will rebase this on top of it and re-verify.

#12349 is the same area and in the same state, approved and green, open since 09-16. It is the production fix behind #12332, and SEZ9 confirmed on 09-20 that nothing further is needed there.

@nzw921rx

Copy link
Copy Markdown
Member

@nzw921rx heads up on an overlap: this PR and your #12350 both edit RocketMqIT.java, so whichever lands second will need a rebase.

This one is +30/-5 on that file, approved, CI green. #12350 is +51/-59 and currently conflicts with dev, probably from #12323, #12393 and #12396 landing in that file after it was opened. The two do not overlap in intent, since this change only wraps the remaining offset reads in the retry and route guard that are already in the file. If you would rather land #12350 first, I will rebase this on top of it and re-verify.

#12349 is the same area and in the same state, approved and green, open since 09-16. It is the production fix behind #12332, and SEZ9 confirmed on 09-20 that nothing further is needed there.

Thanks for the heads-up. Please go ahead with this PR. I’ll rebase #12350 onto the latest dev afterward

@nzw921rx nzw921rx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 good job

@nzw921rx
nzw921rx added this pull request to the merge queue Sep 21, 2026
Merged via the queue into apache:dev with commit 36c0d1b Sep 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants