You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "nsivabalan (via GitHub)" <gi...@apache.org> on 2023/05/21 20:28:06 UTC

[GitHub] [hudi] nsivabalan opened a new pull request, #8774: [HUDI-6246] Fixing restore for compaction commit

nsivabalan opened a new pull request, #8774:
URL: https://github.com/apache/hudi/pull/8774

   ### Change Logs
   
   Looks like after this patch https://github.com/apache/hudi/pull/4957/files, we have a bug wrt restore. rolling back a completed compaction should clean up all associated log files as well, but after this patch, only the base file is cleaned up. 
   
   ### Impact
   
   Before this patch, there could be some dangling data files even though there won't be any data consistency issues. After this patch, there won't be any dangling files. 
   
   ### Risk level (write none, low medium or high below)
   
   low.
   
   ### Documentation Update
   
   N/A
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1556293758

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1623914635

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345",
       "triggerID" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3cb5e571f92dd4c6f70d1ad5f7889e9575d60857",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3cb5e571f92dd4c6f70d1ad5f7889e9575d60857",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   * 977ebc09c92f336645e0470bedea7d5ce0cf2df5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345) 
   * 3cb5e571f92dd4c6f70d1ad5f7889e9575d60857 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] codope commented on a diff in pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #8774:
URL: https://github.com/apache/hudi/pull/8774#discussion_r1200730726


##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestSavepointRestoreMergeOnRead.java:
##########
@@ -102,13 +106,104 @@ void testCleaningDeltaCommits() throws Exception {
         if (i == 1) {
           Option<String> compactionInstant = client.scheduleCompaction(Option.empty());
           assertTrue(compactionInstant.isPresent(), "A compaction plan should be scheduled");
+          compactionCommit = compactionInstant.get();
           client.compact(compactionInstant.get());
         }
       }
 
       // restore
       client.restoreToSavepoint(Objects.requireNonNull(savepointCommit, "restore commit should not be null"));
       assertRowNumberEqualsTo(30);
+      // ensure there are no data files matching the compaction commit that was rolled back.
+      String finalCompactionCommit = compactionCommit;
+      PathFilter filter = (path) -> path.toString().contains(finalCompactionCommit);
+      for (String pPath : dataGen.getPartitionPaths()) {
+        assertEquals(0, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+      }
+    }
+  }
+
+  @Test
+  public void testRestoreWithFileGroupCreatedWithDeltaCommits() throws IOException {
+    HoodieWriteConfig hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4)
+            .withInlineCompaction(true)
+            .build())
+        .withRollbackUsingMarkers(true)
+        .build();
+    final int numRecords = 100;
+    String firstCommit;
+    String secondCommit;
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      // 1st commit insert
+      String newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.insert(writeRecords, newCommitTime);
+      firstCommit = newCommitTime;
+
+      // 2nd commit with inserts and updates which will create new file slice due to small file handling.
+      newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records2 = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords2 = jsc.parallelize(records2, 1);
+      List<HoodieRecord> records3 = dataGen.generateInserts(newCommitTime, 30);
+      JavaRDD<HoodieRecord> writeRecords3 = jsc.parallelize(records3, 1);
+
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords2.union(writeRecords3), newCommitTime);
+      secondCommit = newCommitTime;
+      // add savepoint to 2nd commit
+      client.savepoint(firstCommit, "test user","test comment");

Review Comment:
   should it be `secondCommit` as per the comment?



##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestSavepointRestoreMergeOnRead.java:
##########
@@ -102,13 +106,104 @@ void testCleaningDeltaCommits() throws Exception {
         if (i == 1) {
           Option<String> compactionInstant = client.scheduleCompaction(Option.empty());
           assertTrue(compactionInstant.isPresent(), "A compaction plan should be scheduled");
+          compactionCommit = compactionInstant.get();
           client.compact(compactionInstant.get());
         }
       }
 
       // restore
       client.restoreToSavepoint(Objects.requireNonNull(savepointCommit, "restore commit should not be null"));
       assertRowNumberEqualsTo(30);
+      // ensure there are no data files matching the compaction commit that was rolled back.
+      String finalCompactionCommit = compactionCommit;
+      PathFilter filter = (path) -> path.toString().contains(finalCompactionCommit);
+      for (String pPath : dataGen.getPartitionPaths()) {
+        assertEquals(0, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+      }
+    }
+  }
+
+  @Test
+  public void testRestoreWithFileGroupCreatedWithDeltaCommits() throws IOException {
+    HoodieWriteConfig hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4)
+            .withInlineCompaction(true)
+            .build())
+        .withRollbackUsingMarkers(true)
+        .build();
+    final int numRecords = 100;
+    String firstCommit;
+    String secondCommit;
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      // 1st commit insert
+      String newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.insert(writeRecords, newCommitTime);
+      firstCommit = newCommitTime;
+
+      // 2nd commit with inserts and updates which will create new file slice due to small file handling.
+      newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records2 = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords2 = jsc.parallelize(records2, 1);
+      List<HoodieRecord> records3 = dataGen.generateInserts(newCommitTime, 30);
+      JavaRDD<HoodieRecord> writeRecords3 = jsc.parallelize(records3, 1);
+
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords2.union(writeRecords3), newCommitTime);
+      secondCommit = newCommitTime;
+      // add savepoint to 2nd commit
+      client.savepoint(firstCommit, "test user","test comment");
+    }
+    assertRowNumberEqualsTo(130);
+    // verify there are new base files created matching the 2nd commit timestamp.
+    PathFilter filter = (path) -> path.toString().contains(secondCommit);
+    for (String pPath : dataGen.getPartitionPaths()) {
+      assertEquals(1, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+    }
+
+    // disable small file handling so that updates go to log files.
+    hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4) // the 4th delta_commit triggers compaction
+            .withInlineCompaction(true)
+            .compactionSmallFileSize(0)
+            .build())
+        .withRollbackUsingMarkers(true)
+        .build();
+
+    // add 2 more updates which will create log files.
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      String newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords, newCommitTime);
+
+      newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      records = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords, newCommitTime);
+    }
+    assertRowNumberEqualsTo(130);
+
+    // restore to 2nd commit.
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      client.restoreToSavepoint(firstCommit);

Review Comment:
   same here - restore to `secondCommit`?



##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/ListingBasedRollbackStrategy.java:
##########
@@ -117,21 +126,22 @@ public List<HoodieRollbackRequest> getRollbackRequests(HoodieInstant instantToRo
               // If there is no delta commit present after the current commit (if compaction), no action, else we
               // need to make sure that a compaction commit rollback also deletes any log files written as part of the
               // succeeding deltacommit.
-              boolean higherDeltaCommits =
+              boolean hasHigherCompletedDeltaCommits =
                   !activeTimeline.getDeltaCommitTimeline().filterCompletedInstants().findInstantsAfter(commit, 1)
                       .empty();
-              if (higherDeltaCommits) {
-                // Rollback of a compaction action with no higher deltacommit means that the compaction is scheduled
+              if (hasHigherCompletedDeltaCommits && !isCommitMetadataCompleted) {

Review Comment:
   How's it possible that there are higher delta commits and compaction has completed? Is restore running concurrently with ingestion?



##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestSavepointRestoreMergeOnRead.java:
##########
@@ -102,13 +106,104 @@ void testCleaningDeltaCommits() throws Exception {
         if (i == 1) {
           Option<String> compactionInstant = client.scheduleCompaction(Option.empty());
           assertTrue(compactionInstant.isPresent(), "A compaction plan should be scheduled");
+          compactionCommit = compactionInstant.get();
           client.compact(compactionInstant.get());
         }
       }
 
       // restore
       client.restoreToSavepoint(Objects.requireNonNull(savepointCommit, "restore commit should not be null"));
       assertRowNumberEqualsTo(30);
+      // ensure there are no data files matching the compaction commit that was rolled back.
+      String finalCompactionCommit = compactionCommit;
+      PathFilter filter = (path) -> path.toString().contains(finalCompactionCommit);
+      for (String pPath : dataGen.getPartitionPaths()) {
+        assertEquals(0, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+      }
+    }
+  }
+
+  @Test
+  public void testRestoreWithFileGroupCreatedWithDeltaCommits() throws IOException {
+    HoodieWriteConfig hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4)
+            .withInlineCompaction(true)
+            .build())
+        .withRollbackUsingMarkers(true)
+        .build();
+    final int numRecords = 100;
+    String firstCommit;
+    String secondCommit;
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      // 1st commit insert
+      String newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.insert(writeRecords, newCommitTime);
+      firstCommit = newCommitTime;
+
+      // 2nd commit with inserts and updates which will create new file slice due to small file handling.
+      newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records2 = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords2 = jsc.parallelize(records2, 1);
+      List<HoodieRecord> records3 = dataGen.generateInserts(newCommitTime, 30);
+      JavaRDD<HoodieRecord> writeRecords3 = jsc.parallelize(records3, 1);
+
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords2.union(writeRecords3), newCommitTime);
+      secondCommit = newCommitTime;
+      // add savepoint to 2nd commit
+      client.savepoint(firstCommit, "test user","test comment");
+    }
+    assertRowNumberEqualsTo(130);
+    // verify there are new base files created matching the 2nd commit timestamp.
+    PathFilter filter = (path) -> path.toString().contains(secondCommit);
+    for (String pPath : dataGen.getPartitionPaths()) {
+      assertEquals(1, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+    }
+
+    // disable small file handling so that updates go to log files.
+    hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4) // the 4th delta_commit triggers compaction
+            .withInlineCompaction(true)
+            .compactionSmallFileSize(0)
+            .build())
+        .withRollbackUsingMarkers(true)

Review Comment:
   Shouldn't it be false to test ListingBasedRollback?



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


[GitHub] [hudi] codope commented on a diff in pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #8774:
URL: https://github.com/apache/hudi/pull/8774#discussion_r1253039616


##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestSavepointRestoreMergeOnRead.java:
##########
@@ -102,13 +106,104 @@ void testCleaningDeltaCommits() throws Exception {
         if (i == 1) {
           Option<String> compactionInstant = client.scheduleCompaction(Option.empty());
           assertTrue(compactionInstant.isPresent(), "A compaction plan should be scheduled");
+          compactionCommit = compactionInstant.get();
           client.compact(compactionInstant.get());
         }
       }
 
       // restore
       client.restoreToSavepoint(Objects.requireNonNull(savepointCommit, "restore commit should not be null"));
       assertRowNumberEqualsTo(30);
+      // ensure there are no data files matching the compaction commit that was rolled back.
+      String finalCompactionCommit = compactionCommit;
+      PathFilter filter = (path) -> path.toString().contains(finalCompactionCommit);
+      for (String pPath : dataGen.getPartitionPaths()) {
+        assertEquals(0, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+      }
+    }
+  }
+
+  @Test
+  public void testRestoreWithFileGroupCreatedWithDeltaCommits() throws IOException {
+    HoodieWriteConfig hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4)
+            .withInlineCompaction(true)
+            .build())
+        .withRollbackUsingMarkers(true)
+        .build();
+    final int numRecords = 100;
+    String firstCommit;
+    String secondCommit;
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      // 1st commit insert
+      String newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.insert(writeRecords, newCommitTime);
+      firstCommit = newCommitTime;
+
+      // 2nd commit with inserts and updates which will create new file slice due to small file handling.
+      newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records2 = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords2 = jsc.parallelize(records2, 1);
+      List<HoodieRecord> records3 = dataGen.generateInserts(newCommitTime, 30);
+      JavaRDD<HoodieRecord> writeRecords3 = jsc.parallelize(records3, 1);
+
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords2.union(writeRecords3), newCommitTime);
+      secondCommit = newCommitTime;
+      // add savepoint to 2nd commit
+      client.savepoint(firstCommit, "test user","test comment");

Review Comment:
   actually it doesn't matter as long as we do retore after compaction, both 1st and 2nd commit is fine but i would fix the comment if restoring to first commit.



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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1623926880

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345",
       "triggerID" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3cb5e571f92dd4c6f70d1ad5f7889e9575d60857",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18381",
       "triggerID" : "3cb5e571f92dd4c6f70d1ad5f7889e9575d60857",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   * 977ebc09c92f336645e0470bedea7d5ce0cf2df5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345) 
   * 3cb5e571f92dd4c6f70d1ad5f7889e9575d60857 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18381) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] nsivabalan merged pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan merged PR #8774:
URL: https://github.com/apache/hudi/pull/8774


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


[GitHub] [hudi] nsivabalan commented on a diff in pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "nsivabalan (via GitHub)" <gi...@apache.org>.
nsivabalan commented on code in PR #8774:
URL: https://github.com/apache/hudi/pull/8774#discussion_r1248439284


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/rollback/ListingBasedRollbackStrategy.java:
##########
@@ -117,21 +126,22 @@ public List<HoodieRollbackRequest> getRollbackRequests(HoodieInstant instantToRo
               // If there is no delta commit present after the current commit (if compaction), no action, else we
               // need to make sure that a compaction commit rollback also deletes any log files written as part of the
               // succeeding deltacommit.
-              boolean higherDeltaCommits =
+              boolean hasHigherCompletedDeltaCommits =
                   !activeTimeline.getDeltaCommitTimeline().filterCompletedInstants().findInstantsAfter(commit, 1)
                       .empty();
-              if (higherDeltaCommits) {
-                // Rollback of a compaction action with no higher deltacommit means that the compaction is scheduled
+              if (hasHigherCompletedDeltaCommits && !isCommitMetadataCompleted) {

Review Comment:
   due to async compaction. 



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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1622622288

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345",
       "triggerID" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   * 977ebc09c92f336645e0470bedea7d5ce0cf2df5 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] codope commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1558614877

   @hudi-bot run azure


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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1621703550

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345",
       "triggerID" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   * 977ebc09c92f336645e0470bedea7d5ce0cf2df5 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1621689899

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   * 977ebc09c92f336645e0470bedea7d5ce0cf2df5 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1624163088

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     }, {
       "hash" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18345",
       "triggerID" : "977ebc09c92f336645e0470bedea7d5ce0cf2df5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3cb5e571f92dd4c6f70d1ad5f7889e9575d60857",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18381",
       "triggerID" : "3cb5e571f92dd4c6f70d1ad5f7889e9575d60857",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   * 3cb5e571f92dd4c6f70d1ad5f7889e9575d60857 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=18381) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] codope commented on a diff in pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #8774:
URL: https://github.com/apache/hudi/pull/8774#discussion_r1253046201


##########
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/functional/TestSavepointRestoreMergeOnRead.java:
##########
@@ -102,13 +106,104 @@ void testCleaningDeltaCommits() throws Exception {
         if (i == 1) {
           Option<String> compactionInstant = client.scheduleCompaction(Option.empty());
           assertTrue(compactionInstant.isPresent(), "A compaction plan should be scheduled");
+          compactionCommit = compactionInstant.get();
           client.compact(compactionInstant.get());
         }
       }
 
       // restore
       client.restoreToSavepoint(Objects.requireNonNull(savepointCommit, "restore commit should not be null"));
       assertRowNumberEqualsTo(30);
+      // ensure there are no data files matching the compaction commit that was rolled back.
+      String finalCompactionCommit = compactionCommit;
+      PathFilter filter = (path) -> path.toString().contains(finalCompactionCommit);
+      for (String pPath : dataGen.getPartitionPaths()) {
+        assertEquals(0, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+      }
+    }
+  }
+
+  @Test
+  public void testRestoreWithFileGroupCreatedWithDeltaCommits() throws IOException {
+    HoodieWriteConfig hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4)
+            .withInlineCompaction(true)
+            .build())
+        .withRollbackUsingMarkers(true)
+        .build();
+    final int numRecords = 100;
+    String firstCommit;
+    String secondCommit;
+    try (SparkRDDWriteClient client = getHoodieWriteClient(hoodieWriteConfig)) {
+      // 1st commit insert
+      String newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records = dataGen.generateInserts(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords = jsc.parallelize(records, 1);
+      client.startCommitWithTime(newCommitTime);
+      client.insert(writeRecords, newCommitTime);
+      firstCommit = newCommitTime;
+
+      // 2nd commit with inserts and updates which will create new file slice due to small file handling.
+      newCommitTime = HoodieActiveTimeline.createNewInstantTime();
+      List<HoodieRecord> records2 = dataGen.generateUniqueUpdates(newCommitTime, numRecords);
+      JavaRDD<HoodieRecord> writeRecords2 = jsc.parallelize(records2, 1);
+      List<HoodieRecord> records3 = dataGen.generateInserts(newCommitTime, 30);
+      JavaRDD<HoodieRecord> writeRecords3 = jsc.parallelize(records3, 1);
+
+      client.startCommitWithTime(newCommitTime);
+      client.upsert(writeRecords2.union(writeRecords3), newCommitTime);
+      secondCommit = newCommitTime;
+      // add savepoint to 2nd commit
+      client.savepoint(firstCommit, "test user","test comment");
+    }
+    assertRowNumberEqualsTo(130);
+    // verify there are new base files created matching the 2nd commit timestamp.
+    PathFilter filter = (path) -> path.toString().contains(secondCommit);
+    for (String pPath : dataGen.getPartitionPaths()) {
+      assertEquals(1, fs.listStatus(FSUtils.getPartitionPath(hoodieWriteConfig.getBasePath(), pPath), filter).length);
+    }
+
+    // disable small file handling so that updates go to log files.
+    hoodieWriteConfig = getConfigBuilder(HoodieFailedWritesCleaningPolicy.EAGER) // eager cleaning
+        .withCompactionConfig(HoodieCompactionConfig.newBuilder()
+            .withMaxNumDeltaCommitsBeforeCompaction(4) // the 4th delta_commit triggers compaction
+            .withInlineCompaction(true)
+            .compactionSmallFileSize(0)
+            .build())
+        .withRollbackUsingMarkers(true)

Review Comment:
   changed to false.



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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1557587611

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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


[GitHub] [hudi] hudi-bot commented on pull request #8774: [HUDI-6246] Fixing restore for compaction commit

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8774:
URL: https://github.com/apache/hudi/pull/8774#issuecomment-1558668225

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe28587616d76a4f1183944dd2bd4ac8ee5bad7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1558614877",
       "triggerType" : "MANUAL"
     } ]
   }-->
   ## CI report:
   
   * afe28587616d76a4f1183944dd2bd4ac8ee5bad7 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


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