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/04/11 02:19:13 UTC

[GitHub] [hudi] nsivabalan commented on a diff in pull request #5261: [HUDI-3799] Fixing not deleting empty instants w/o archiving

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


##########
hudi-common/src/test/java/org/apache/hudi/common/testutils/HoodieTestTable.java:
##########
@@ -286,8 +286,8 @@ public HoodieTestTable addClean(String instantTime, HoodieCleanerPlan cleanerPla
   }
 
   public HoodieTestTable addClean(String instantTime, HoodieCleanerPlan cleanerPlan, HoodieCleanMetadata metadata, boolean isEmpty) throws IOException {
-    createRequestedCleanFile(basePath, instantTime, cleanerPlan, isEmpty);
-    createInflightCleanFile(basePath, instantTime, cleanerPlan, isEmpty);
+    createRequestedCleanFile(basePath, instantTime, cleanerPlan, false);
+    createInflightCleanFile(basePath, instantTime, cleanerPlan, false);

Review Comment:
   empty requested and empty inflight should be addressed by action executors. only completed being empty can be encountered by archival. and thats why. 



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/utils/MetadataConversionUtils.java:
##########
@@ -125,6 +125,46 @@ public static HoodieArchivedMetaEntry createMetaWrapper(HoodieInstant hoodieInst
     return archivedMetaWrapper;
   }
 
+  public static HoodieArchivedMetaEntry createMetaWrapperForEmptyInstant(HoodieInstant hoodieInstant) throws IOException {
+    HoodieArchivedMetaEntry archivedMetaWrapper = new HoodieArchivedMetaEntry();
+    archivedMetaWrapper.setCommitTime(hoodieInstant.getTimestamp());
+    archivedMetaWrapper.setActionState(hoodieInstant.getState().name());
+    switch (hoodieInstant.getAction()) {
+      case HoodieTimeline.CLEAN_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.clean.name());
+        break;
+      }
+      case HoodieTimeline.COMMIT_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.commit.name());
+        break;
+      }
+      case HoodieTimeline.DELTA_COMMIT_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.deltacommit.name());
+        break;
+      }
+      case HoodieTimeline.REPLACE_COMMIT_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.replacecommit.name());
+        break;
+      }
+      case HoodieTimeline.ROLLBACK_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.rollback.name());
+        break;
+      }
+      case HoodieTimeline.SAVEPOINT_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.savepoint.name());
+        break;
+      }
+      case HoodieTimeline.COMPACTION_ACTION: {
+        archivedMetaWrapper.setActionType(ActionType.compaction.name());

Review Comment:
   sg.



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