You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by vb...@apache.org on 2019/09/13 19:40:19 UTC

[incubator-hudi] branch master updated: Fix requested eompaction rollback during restore command

This is an automated email from the ASF dual-hosted git repository.

vbalaji pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b032b2  Fix requested eompaction rollback during restore command
0b032b2 is described below

commit 0b032b2761fcc23a3bcedaf654431635ec7e7f03
Author: Nishith Agarwal <na...@uber.com>
AuthorDate: Mon Sep 2 10:20:41 2019 -0700

    Fix requested eompaction rollback during restore command
---
 .../src/main/java/org/apache/hudi/HoodieWriteClient.java | 16 ++++++----------
 .../java/org/apache/hudi/table/TestMergeOnReadTable.java |  7 ++++++-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/hudi-client/src/main/java/org/apache/hudi/HoodieWriteClient.java b/hudi-client/src/main/java/org/apache/hudi/HoodieWriteClient.java
index d81ecaf..e6b3152 100644
--- a/hudi-client/src/main/java/org/apache/hudi/HoodieWriteClient.java
+++ b/hudi-client/src/main/java/org/apache/hudi/HoodieWriteClient.java
@@ -808,16 +808,12 @@ public class HoodieWriteClient<T extends HoodieRecordPayload> extends AbstractHo
             instantsToStats.put(instant.getTimestamp(), statsForInstant);
             break;
           case HoodieTimeline.COMPACTION_ACTION:
-            if (instant.isRequested()) {
-              // TODO : Get file status and create a rollback stat and file
-              // TODO : Delete the .aux files along with the instant file, okay for now since the archival process will
-              // delete these files when it does not see a corresponding instant file under .hoodie
-              deleteRequestedCompaction(instant.getTimestamp());
-              logger.info("Deleted pending scheduled compaction " + instant.getTimestamp());
-            } else {
-              List<HoodieRollbackStat> statsForCompaction = doRollbackAndGetStats(instant.getTimestamp());
-              instantsToStats.put(instant.getTimestamp(), statsForCompaction);
-            }
+            // TODO : Get file status and create a rollback stat and file
+            // TODO : Delete the .aux files along with the instant file, okay for now since the archival process will
+            // delete these files when it does not see a corresponding instant file under .hoodie
+            List<HoodieRollbackStat> statsForCompaction = doRollbackAndGetStats(instant.getTimestamp());
+            instantsToStats.put(instant.getTimestamp(), statsForCompaction);
+            logger.info("Deleted compaction instant " + instant);
             break;
           default:
             throw new IllegalArgumentException("invalid action name " + instant.getAction());
diff --git a/hudi-client/src/test/java/org/apache/hudi/table/TestMergeOnReadTable.java b/hudi-client/src/test/java/org/apache/hudi/table/TestMergeOnReadTable.java
index 2b80125..a4789e9 100644
--- a/hudi-client/src/test/java/org/apache/hudi/table/TestMergeOnReadTable.java
+++ b/hudi-client/src/test/java/org/apache/hudi/table/TestMergeOnReadTable.java
@@ -680,6 +680,11 @@ public class TestMergeOnReadTable extends HoodieClientTestHarness {
       List<HoodieFileGroup> fileGroups = ((HoodieTableFileSystemView) rtView).getAllFileGroups().collect(Collectors
           .toList());
       assertTrue(fileGroups.isEmpty());
+
+      // make sure there are no log files remaining
+      assertTrue(((HoodieTableFileSystemView) rtView).getAllFileGroups().filter(fileGroup -> fileGroup
+          .getAllRawFileSlices().filter(f -> f.getLogFiles().count() == 0).count() == 0).count() == 0L);
+
     }
   }
 
@@ -1259,4 +1264,4 @@ public class TestMergeOnReadTable extends HoodieClientTestHarness {
       assertFalse("Errors found in write of " + status.getFileId(), status.hasErrors());
     }
   }
-}
+}
\ No newline at end of file