eric9204 commented on code in PR #10188:
URL: https://github.com/apache/hudi/pull/10188#discussion_r1408745384


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/heartbeat/HoodieHeartbeatClient.java:
##########
@@ -266,6 +266,11 @@ private void updateHeartbeat(String instantTime) throws 
HoodieHeartbeatException
       heartbeat.setLastHeartbeatTime(newHeartbeatTime);
       heartbeat.setNumHeartbeats(heartbeat.getNumHeartbeats() + 1);
     } catch (IOException io) {
+      Boolean isHeartbeatStopped = 
instantToHeartbeatMap.get(instantTime).isHeartbeatStopped;
+      if (isHeartbeatStopped) {
+        LOG.warn(String.format("update heart beat failed, because the instant 
time %s was stopped ? : %s", instantTime, isHeartbeatStopped));
+        return;
+      }

Review Comment:
   @nsivabalan 
   It is difficult that the asynchronous heartbeat Timer task thread sends a 
request to update the heartbeat file to hdfs when the write client stops the 
heartbeat.
   I can only write a similar unit test as follows. Do you have any suggestions?
   ```
   @Test
     public void testUpdateStoppedHeartbeat() {
   
       HoodieHeartbeatClient hoodieHeartbeatClient =
   
           new HoodieHeartbeatClient(metaClient.getFs(), 
metaClient.getBasePath(), heartBeatInterval, numTolerableMisses);
   
       hoodieHeartbeatClient.start(instantTime1);
   
       hoodieHeartbeatClient.stopHeartbeatTimers();
   
       assertDoesNotThrow(() -> 
hoodieHeartbeatClient.updateHeartbeat(instantTime1));
     }
   ```



-- 
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]

Reply via email to