XuQianJin-Stars commented on code in PR #3518:
URL: https://github.com/apache/fluss/pull/3518#discussion_r3465663470


##########
fluss-lake/fluss-lake-hudi/src/main/java/org/apache/fluss/lake/hudi/tiering/HudiLakeCommitter.java:
##########
@@ -250,6 +301,15 @@ private void abortInstant(String instant) throws 
IOException {
         }
     }
 
+    private void abortCompactionInstant(String instant) throws IOException {
+        try {
+            CompactionUtil.rollbackCompaction(

Review Comment:
   `writeClient.getHoodieTable()` is cached against the last refresh; if 
`abort` is invoked before any `reloadActiveTimeline()` since the inflight 
compaction was created, the rollback target may be stale. Add 
`hudiTableInfo.getMetaClient().reloadActiveTimeline()` immediately before this 
call (similar to what `getCompletedTimelineCommittedBy` does).



##########
fluss-lake/fluss-lake-hudi/src/main/java/org/apache/fluss/lake/hudi/tiering/HudiLakeWriter.java:
##########
@@ -75,6 +86,16 @@ public HudiLakeWriter(
         }
 
         this.recordWriter = new HudiRecordWriter(writerInitContext, 
hudiTableInfo, ckpMetadata);
+        if (shouldRunCompaction(writerInitContext)) {
+            this.compactionExecutor =
+                    Executors.newSingleThreadExecutor(
+                            new ExecutorThreadFactory(
+                                    "hudi-compact-" + 
writerInitContext.tableBucket()));
+            this.compactionFuture = 
executeCompactionAsync(hudiCatalogProvider, writerInitContext);

Review Comment:
   Starting an asynchronous compaction task inside the constructor is risky: if 
any line below this throws (e.g. the LOG.info call OOMs), the future is already 
running and references `this`/`hudiCatalogProvider` even though the object was 
never published to the caller. That is the classic 'this escape during 
construction' pattern.
   
   Move `executeCompactionAsync(...)` to be the very last statement of the 
constructor, after the LOG.info, or trigger the async task lazily on the first 
`complete()` invocation.



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