stream2000 commented on code in PR #9160:
URL: https://github.com/apache/hudi/pull/9160#discussion_r1258252935
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/heartbeat/HoodieHeartbeatClient.java:
##########
@@ -185,36 +179,55 @@ public void start(String instantTime) {
}
/**
- * Stops the heartbeat for the specified instant.
- * @param instantTime
+ * Stops the heartbeat and deletes the heartbeat file for the specified
instant.
+ *
+ * @param instantTime The instant time for the heartbeat.
* @throws HoodieException
*/
public void stop(String instantTime) throws HoodieException {
Heartbeat heartbeat = instantToHeartbeatMap.get(instantTime);
- if (heartbeat != null && heartbeat.isHeartbeatStarted() &&
!heartbeat.isHeartbeatStopped()) {
- LOG.info("Stopping heartbeat for instant " + instantTime);
- heartbeat.getTimer().cancel();
- heartbeat.setHeartbeatStopped(true);
- LOG.info("Stopped heartbeat for instant " + instantTime);
+ if (isHeartbeatStarted(heartbeat)) {
+ stopHeartbeatTimer(heartbeat);
HeartbeatUtils.deleteHeartbeatFile(fs, basePath, instantTime);
LOG.info("Deleted heartbeat file for instant " + instantTime);
}
}
/**
* Stops all heartbeats started via this instance of the client.
+ *
Review Comment:
We can add a comment like 'Note that we won't delete the heartbeat file by
stop' or just rename this method to `stopTimers`
--
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]