You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org> on 2026/09/19 04:58:34 UTC
[PR] [Fix][E2E] Make RocketMqIT.deleteTopicIfExist actually delete the topic [seatunnel]
SEPURI-SAI-KRISHNA opened a new pull request, #12393:
URL: https://github.com/apache/seatunnel/pull/12393
### Purpose of this pull request
`RocketMqIT.deleteTopicIfExist` has never deleted a topic. I found this while working on #12349 and said there that I would raise it separately.
Three defects compound:
* `deleteTopicInBroker(Set<String> addrs, String topic)` and `deleteTopicInNameServer(Set<String> addrs, String topic, String clusterName)` both expect **addresses**. The helper passed broker **names**, collected from `QueueData::getBrokerName`. A broker name does not resolve to a host, so the request fails immediately.
* The literal `"delete_topic"` was passed as the third argument, which is the cluster name rather than a reason string. Confirmed against 4.9.4: in `MQClientAPIImpl.deleteTopicInNameServer` the second argument reaches `setTopic` and the third reaches `setClusterName`.
* A blanket `catch (Exception e) { log.warn(...) }` reduced the whole thing to a warning nobody reads in a passing run.
The first defect fails first, so the name server call is never even reached.
**Evidence:** `Failed to delete topic ...: connect to null failed` appears **14 times in each of three job logs**, across two separate CI runs of this suite, and `Deleted topic` appears **zero** times in any of them. The callers, `testSourceRocketMqTextTagToConsole` and `testSourceRocketMqTextErrorTagToConsole`, therefore start from whatever state the previous run left behind rather than from the clean topic they assume.
### The fix
Broker addresses now come from `TopicRouteData.getBrokerDatas()`, taking every entry of `getBrokerAddrs()` rather than one per broker. That matches RocketMQ's own `DeleteTopicSubCommand`, which resolves masters and slaves and deletes against all of them. `selectBrokerAddr()` would have been the obvious single-value choice, but it returns the master only when one is registered and otherwise picks at random, which is not a sound basis for a delete. The name server call passes a null address set, which makes the client resolve the name server list itself, and a null cluster name, which makes the name server take its global `RouteInfoManager.deleteTopic(topic)` branch instead of scoping the request to a cluster that never existed. I checked that branch rather than assuming it: `DefaultRequestProcessor.deleteTopicInNamesrv` tests the cluster name for null and for empty, and falls through to the global delete in both cases.
A failure now throws instead of being logged and dropped. A helper named `deleteTopicIfExist` that returns normally should mean the topic is gone; if it cannot guarantee that, the caller is asserting against state it did not establish. The "topic is not there" case is still handled explicitly and returns quietly, so this only throws on a real failure.
I also dropped a dead `admin != null` check in the `finally`, since `admin` is assigned from `new DefaultMQAdminExt()` on the line above and cannot be null.
### Two things I want to be straight about
**This is the first time the deletion will actually happen.** Until now these two tests have been running against an undeleted topic. Making the cleanup work is a genuine behaviour change for them, and this PR's own CI is the first real signal on whether they are happy with a topic that is truly reset. I would rather find that out here than leave a cleanup helper that lies.
**I am not claiming this fixes their flakiness.** Both callers sit in the `RocketMqIT` failure cluster from #12322 at 6 of 12 sampled days, and stale topic state is a plausible contributor, but I have not demonstrated that connection and I am not asserting it.
### Does this PR introduce _any_ user-facing change?
No. Test-only, one E2E class, no production code.
### How was this patch tested?
`./mvnw -q -DskipTests verify -pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-rocketmq-e2e` on JDK 11 passes, covering the enforcer checks, `spotless:check` and compilation. `spotless:check` was also run separately with up-to-date caching disabled.
No new test class is added: the change is to `RocketMqIT` itself, so the IT is both the subject and the coverage, and the `rocketmq-connector-it` legs exercise it through the two callers above.
### One deferred item
@DanielLeens asked on #12349 for a comment on the multi-topic early-return in `RocketMqAdminUtil.currentOffsets`, and agreed it could ride along with this change. I have left it out deliberately: it sits in a method #12349 is currently rewriting, so adding it here would put that PR into conflict. It will follow once #12349 merges.
--
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] [Test][E2E] Remove RocketMqIT.deleteTopicIfExist, which never deleted anything [seatunnel]
Posted by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org>.
SEPURI-SAI-KRISHNA commented on PR #12393:
URL: https://github.com/apache/seatunnel/pull/12393#issuecomment-5742715460
CI is green on `5de3911b8`. Both `rocketmq-connector-it` legs passed, JDK 11 at 11:10 and JDK 8 at 11:17, with no failed job anywhere in the run.
The JDK 11 leg reports 87 tests, 0 failures, 0 errors, against 87 tests with 14 errors on the previous head where the repair attempt was still in place. Those 14 were both tag tests on every engine leg, which is the deterministic failure your Issue 1 predicted. The `Failed to delete topic ...: connect to null failed` warning that appears 14 times per job log on `dev` is also now absent, which is the other half of the evidence that the helper was a no-op and is gone.
So this matches `dev` rather than diverging from it, as expected for removing dead code, and there was no RocketMQ leg failure to compare against #12322.
Thank you for withdrawing Issue 3 so directly, and for going to the upstream 4.9.4 broker source on the offset question rather than taking my word for it. The `scanUnsubscribedTopic` predicate point was one I had not checked.
I will open the topic and consumer group isolation change as a separate PR shortly, following the `uniqueTestSuffix()` plus job-variable pattern this file already uses at `RocketMqIT.java:388-389` and `:429-431`.
--
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] [Test][E2E] Remove RocketMqIT.deleteTopicIfExist, which never deleted anything [seatunnel]
Posted by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org>.
SEPURI-SAI-KRISHNA commented on PR #12393:
URL: https://github.com/apache/seatunnel/pull/12393#issuecomment-5740950176
Thank you for this, and for saying clearly which parts you could verify and which you could not. That distinction is what made the review useful rather than just directional.
I have taken the PR in a different direction as a result: the helper is now **removed** rather than repaired. The reasoning is in the updated description; the short version is that your Issue 4 turned out to be decisive, and it decides against fixing the method at all.
**Issues 1 and 2: both confirmed, and both mine.**
Issue 1 is the one I am least happy about. Earlier in this series, while investigating #12332, I decompiled `getTopicRouteInfoFromNameServer` and established that it always throws rather than returning null, and I wrote exactly that into a comment on #12332. Then I wrote a null guard against it here anyway. You are right that the guard is dead and that the first call for each topic would have thrown.
Issue 2 I had not checked, and your reading is correct. `fetchNameServerAddr()` returns the field `nameSrvAddr`, which is assigned only inside the top-addressing success path; `setNamesrvAddr` writes `ClientConfig.namesrvAddr` and reaches the remoting client through `MQClientInstance.updateNameServerAddressList`, never that field. On a runner that cannot reach the top-addressing service it returns null and `ns.split(";")` throws. My comment claiming the client would "resolve the name server list itself" described behaviour the library does not have.
**Issue 4: confirmed, and it is why the method is gone.**
You said you could not determine which way this goes. It goes badly, and the broker jar settles it. `AdminBrokerProcessor.deleteTopic` calls `TopicConfigManager.deleteTopicConfig`, `MessageStore.cleanUnusedTopic` and, under `autoDeleteUnusedStats`, `BrokerStatsManager.onTopicDeleted`. There is no `ConsumerOffsetManager` call in that handler, so committed offsets survive a topic delete.
Combined with `rocketMqContainer` being created in `@BeforeAll` and shared across every engine leg, a working delete gives `testSourceRocketMqTextTagToConsole` a topic reset to offset 0 while the group's committed offset stays at 32, so the second leg onward reads nothing against a 32-row assertion. That test passes today *because* the cleanup never happens.
**One correction to the review.** You describe both confs as `MIN_ROW = MAX_ROW = 32`. `rocketmq-source_text_error_tag_to_console.conf` is `MIN_ROW = MAX_ROW = 0`, which is the point of that test: the tag filter matches nothing. So only `testSourceRocketMqTextTagToConsole` would have broken. That narrows the blast radius to one test but does not change the conclusion.
**Issue 3: I think this one is already covered, and I would rather not add a redundant call.** `generateTestData` calls `waitForTopicRoute(topic)` at line 453 before any send, and that helper both recreates the topic through `producer.createTopic` and asserts the route is visible through `RocketMqAdminUtil.offsetTopics`, which is the fresh-admin path the connector itself uses. #12323 placed it there deliberately so that all nine call sites are covered rather than each test separately. Since `executeJob` runs after `generateTestData`, the route is confirmed before submission. If you still see a gap I have missed, say so and I will add it.
**Issue 5** is resolved by the comments going away with the method.
**On the null cluster name**, where you noted the name server module is not pinned by this repo and so you could not check: I pulled `rocketmq-namesrv:4.9.4` from Maven Central. `DefaultRequestProcessor.deleteTopicInNamesrv` tests the cluster name for null and then for empty, and falls through to the global `RouteInfoManager.deleteTopic(topic)` in both cases. It is moot now, but it may be useful to you elsewhere, and you were right to treat my original wording as an assertion I had not earned.
**Options I considered before removing it**, since this is a reversal rather than a refinement:
1. Fix the helper and also reset the group's offsets after recreating the topic. Correct in principle, but it puts per-queue offset manipulation into a test cleanup helper and deepens its dependence on admin semantics that two earlier versions of this PR already got wrong.
2. Remove it. Behaviour preserving in the strict sense, because the helper is a proven no-op: 14 logged failures and zero successes across three job logs. The callers then run exactly as they do today.
3. Close this and file an issue. Leaves misleading code in the tree for the next person, who would likely "fix" it the way I first did.
I took 2. It is the only one that is both an improvement and provably zero risk.
What it does not do is give those two tests the isolation the helper's name promised. They have never had it. If that is wanted, a dedicated consumer group per topic in the two confs is the honest way, and I am glad to open it separately, but it changes test behaviour and does not belong in a patch that deletes dead code.
--
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] [Test][E2E] Remove RocketMqIT.deleteTopicIfExist, which never deleted anything [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12393:
URL: https://github.com/apache/seatunnel/pull/12393
--
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