You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "stream2000 (via GitHub)" <gi...@apache.org> on 2023/04/23 08:27:51 UTC

[GitHub] [hudi] stream2000 commented on a diff in pull request #8550: [HUDI-6127]Flink Hudi Write support commit on an empty batch

stream2000 commented on code in PR #8550:
URL: https://github.com/apache/hudi/pull/8550#discussion_r1174535278


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/StreamWriteOperatorCoordinator.java:
##########
@@ -522,7 +522,10 @@ private boolean commitInstant(String instant, long checkpointId) {
         .flatMap(Collection::stream)
         .collect(Collectors.toList());
 
-    if (writeResults.size() == 0) {
+    // Control whether we can commit on empty batch to start a new instant after each checkpoint
+    boolean allowCommitOnEmptyBatch = conf.get(FlinkOptions.WRITE_ALLOW_COMMIT_ON_EMPTY_BATCH);
+
+    if (writeResults.size() == 0 && !allowCommitOnEmptyBatch) {

Review Comment:
   When there is no data in current batch but `WRITE_ALLOW_COMMIT_ON_EMPTY_BATCH` is set as true, we will commit instant directly and start a new instant (thus the write functions can get new instant to write and unblock flushing) 
   
   I noticed that in current implementation when there is no data, the write functions will set the `isConfirming` flag as true and wait the coordinator call `sendCommitAckEvents`.  Not sure if there will be some cases that the write function will be blocked because we do not call `sendCommitAckEvents` and just start a new instant instead. 



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