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 2023/01/05 05:58:57 UTC

[GitHub] [hudi] danny0405 commented on a diff in pull request #7609: [HUDI-5504]Fix concurrency conflict when asyncCompaction is enabled

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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/compact/CompactOperator.java:
##########
@@ -95,11 +101,32 @@ public void open() throws Exception {
       this.executor = NonThrownExecutor.builder(LOG).build();
     }
     this.collector = new StreamRecordCollector<>(output);
+    this.mutex = new Object();
+  }
+
+  @Override
+  public void processWatermark(Watermark mark) throws Exception {
+    // thread safe to propagate the watermark when asyncCompaction is enabled
+    if (asyncCompaction) {
+      synchronized (mutex) {
+        super.processWatermark(mark);
+      }
+      return;
+    }
+    super.processWatermark(mark);
   }
 
   @Override
-  public void processWatermark(Watermark mark) {
-    // no need to propagate the watermark
+  public void processLatencyMarker(LatencyMarker latencyMarker)
+      throws Exception {
+    // thread safe to propagate the latencyMarker when asyncCompaction is enabled
+    if (asyncCompaction) {
+      synchronized (mutex) {
+        super.processLatencyMarker(latencyMarker);
+      }

Review Comment:
   Can we just ignore the watermark and latency marker totally ? The compaction operators belongs to the sink ppeline, there is no need to propagate them to downstream.



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