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


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/append/AppendWriteFunctionWithBufferSort.java:
##########
@@ -78,41 +89,56 @@ public void open(Configuration parameters) throws Exception 
{
     List<String> sortKeyList = Arrays.stream(sortKeys.split(",")).map(key -> 
key.trim()).collect(Collectors.toList());
     SortOperatorGen sortOperatorGen = new SortOperatorGen(rowType, 
sortKeyList.toArray(new String[0]));
     SortCodeGenerator codeGenerator = 
sortOperatorGen.createSortCodeGenerator();
-    GeneratedNormalizedKeyComputer keyComputer = 
codeGenerator.generateNormalizedKeyComputer("SortComputer");
-    GeneratedRecordComparator recordComparator = 
codeGenerator.generateRecordComparator("SortComparator");
+    this.keyComputer = 
codeGenerator.generateNormalizedKeyComputer("SortComputer");
+    this.recordComparator = 
codeGenerator.generateRecordComparator("SortComparator");
     MemorySegmentPool memorySegmentPool = 
MemorySegmentPoolFactory.createMemorySegmentPool(config);
-    this.buffer = BufferUtils.createBuffer(rowType,
+
+    this.activeBuffer = BufferUtils.createBuffer(rowType,
             memorySegmentPool,
             
keyComputer.newInstance(Thread.currentThread().getContextClassLoader()),
             
recordComparator.newInstance(Thread.currentThread().getContextClassLoader()));
-    LOG.info("{} is initialized successfully.", getClass().getSimpleName());
+    this.backgroundBuffer = BufferUtils.createBuffer(rowType,
+            MemorySegmentPoolFactory.createMemorySegmentPool(config),
+            
keyComputer.newInstance(Thread.currentThread().getContextClassLoader()),
+            
recordComparator.newInstance(Thread.currentThread().getContextClassLoader()));
+
+    this.asyncWriteExecutor = Executors.newSingleThreadExecutor(r -> {
+      Thread t = new Thread(r, "async-write-thread");
+      t.setDaemon(true);
+      return t;
+    });
+    this.asyncWriteTask = new 
AtomicReference<>(CompletableFuture.completedFuture(null));
+    this.isBackgroundBufferBeingProcessed = new AtomicBoolean(false);

Review Comment:
   then who is the reader?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to