nsivabalan commented on code in PR #12369:
URL: https://github.com/apache/hudi/pull/12369#discussion_r1862750528


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/index/AbstractIndexingCatchupTask.java:
##########
@@ -155,6 +164,15 @@ HoodieInstant awaitInstantCaughtUp(HoodieInstant instant) {
       return null;
     }
     if (!instant.isCompleted()) {
+      // check if instant heartbeat expired, if so then ignore this instant
+      try {
+        if (table.getConfig().getFailedWritesCleanPolicy().isLazy() && 
heartbeatClient.isHeartbeatExpired(instant.requestedTime())) {
+          LOG.info("Ignoring instant " + instant + " as heartbeat expired");
+          return null;

Review Comment:
   btw, we should not be directly calling isHeartbeatExpired. 
   We should be calling `heartbeatExists`, followed by `isHeartbeatExpired` 
with the heart beat client. 
   
   
   in case of a single writer model, 
   ```
   public boolean isHeartbeatExpired(String instantTime) throws IOException {
       Long currentTime = System.currentTimeMillis();
       Heartbeat lastHeartbeatForWriter = 
instantToHeartbeatMap.get(instantTime);
       if (lastHeartbeatForWriter == null) {
         LOG.info("Heartbeat not found in internal map, falling back to reading 
from DFS");
         long lastHeartbeatForWriterTime = getLastHeartbeatTime(this.storage, 
basePath, instantTime);
         lastHeartbeatForWriter = new Heartbeat();
         
lastHeartbeatForWriter.setLastHeartbeatTime(lastHeartbeatForWriterTime);
         lastHeartbeatForWriter.setInstantTime(instantTime);
         lastHeartbeatForWriter.getTimer().cancel();
       }
       if (currentTime - lastHeartbeatForWriter.getLastHeartbeatTime() > 
this.maxAllowableHeartbeatIntervalInMs) {
         LOG.warn("Heartbeat expired, currentTime = " + currentTime + ", last 
heartbeat = " + lastHeartbeatForWriter
             + ", heartbeat interval = " + this.heartbeatIntervalInMs);
         return true;
       }
       return false;
     }
   ```
   we might unintentionally start the heart beat. 
   
   
   
   
   



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