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/20 06:55:30 UTC

[GitHub] [hudi] danny0405 commented on a diff in pull request #5357: [HUDI-3912] Fix lose data when rollback in flink async compact

danny0405 commented on code in PR #5357:
URL: https://github.com/apache/hudi/pull/5357#discussion_r853787325


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/compact/CompactionCommitSink.java:
##########
@@ -132,6 +127,15 @@ private void commitIfNecessary(String instant, Collection<CompactionCommitEvent>
     if (!isReady) {
       return;
     }
+
+    if (events.stream().anyMatch(CompactionCommitEvent::isFailed)) {
+      // handle failure case
+      CompactionUtil.rollbackCompaction(table, instant);
+      // remove commitBuffer avoid commit with preview fileId
+      reset(instant);
+      return;
+    }
+

Review Comment:
   Can we ensure the buffer was cleared like this:
   ```java
   try {
     // handle failure case
     CompactionUtil.rollbackCompaction(table, instant);
   } finally {
     // remove commitBuffer to avoid obsolete metadata commit
     reset(instant);
     return;
   }
   ```



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