fhan688 commented on code in PR #20271:
URL: https://github.com/apache/hudi/pull/20271#discussion_r4245750230
##########
hudi-kafka-connect/src/main/java/org/apache/hudi/connect/transaction/ConnectTransactionCoordinator.java:
##########
@@ -132,24 +135,25 @@ public void start() {
@Override
public void stop() {
- kafkaControlClient.deregisterTransactionCoordinator(this);
- scheduler.shutdownNow();
- hasStarted.set(false);
- if (executorService != null) {
- boolean terminated = false;
+ if (!hasStarted.compareAndSet(true, false)) {
+ return;
+ }
+
+ try {
+ kafkaControlClient.deregisterTransactionCoordinator(this);
+ } finally {
+ scheduler.shutdownNow();
Review Comment:
Thanks for pointing this out. I’ve added lifecycle cleanup to
`ConnectTransactionServices` and made `KafkaConnectTransactionServices.close()`
close the owned write client. The coordinator now closes the services after
event processing exits, ensuring the heartbeat is stopped without racing with
an in-flight commit. A regression test verifies the cleanup ordering and that
close() is called only once.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]