You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/03/08 16:45:05 UTC

[GitHub] [hudi] yihua commented on a change in pull request #4984: [HUDI-3583] Fix MarkerBasedRollbackStrategy NoSuchElementException

yihua commented on a change in pull request #4984:
URL: https://github.com/apache/hudi/pull/4984#discussion_r821857657



##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/MarkerBasedRollbackStrategy.java
##########
@@ -111,16 +113,18 @@ protected HoodieRollbackRequest getRollbackRequestForAppend(String markerFilePat
     // NOTE: Since we're rolling back incomplete Delta Commit, it only could have appended its
     //       block to the latest log-file
     // TODO(HUDI-1517) use provided marker-file's path instead
-    HoodieLogFile latestLogFile = FSUtils.getLatestLogFile(table.getMetaClient().getFs(), partitionPath, fileId,
-        HoodieFileFormat.HOODIE_LOG.getFileExtension(), baseCommitTime).get();
-
-    // NOTE: Marker's don't carry information about the cumulative size of the blocks that have been appended,
-    //       therefore we simply stub this value.
-    Map<String, Long> logFilesWithBlocsToRollback =
-        Collections.singletonMap(latestLogFile.getFileStatus().getPath().toString(), -1L);
+    Option<HoodieLogFile> logFileOption = FSUtils.getLatestLogFile(table.getMetaClient().getFs(), partitionPath, fileId,

Review comment:
       @liujinhui1994 could you add a unit test where the latest log is absent for this new logic?

##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/MarkerBasedRollbackStrategy.java
##########
@@ -111,16 +113,18 @@ protected HoodieRollbackRequest getRollbackRequestForAppend(String markerFilePat
     // NOTE: Since we're rolling back incomplete Delta Commit, it only could have appended its
     //       block to the latest log-file
     // TODO(HUDI-1517) use provided marker-file's path instead
-    HoodieLogFile latestLogFile = FSUtils.getLatestLogFile(table.getMetaClient().getFs(), partitionPath, fileId,
-        HoodieFileFormat.HOODIE_LOG.getFileExtension(), baseCommitTime).get();
-
-    // NOTE: Marker's don't carry information about the cumulative size of the blocks that have been appended,
-    //       therefore we simply stub this value.
-    Map<String, Long> logFilesWithBlocsToRollback =
-        Collections.singletonMap(latestLogFile.getFileStatus().getPath().toString(), -1L);
+    Option<HoodieLogFile> logFileOption = FSUtils.getLatestLogFile(table.getMetaClient().getFs(), partitionPath, fileId,

Review comment:
       nit: `logFileOption` -> `latestLogFileOption`




-- 
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@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org