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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/HoodieCompactor.java:
##########
@@ -130,8 +134,24 @@ public HoodieData<WriteStatus> compact(
     TaskContextSupplier taskContextSupplier = table.getTaskContextSupplier();
     // if this is a MDT, set up the instant range of log reader just like 
regular MDT snapshot reader.
     Option<InstantRange> instantRange = 
CompactHelpers.getInstance().getInstantRange(metaClient);
+
+    boolean useFileGroupReaderBasedCompaction = !metaClient.isMetadataTable()
+        && 
config.getBooleanOrDefault(HoodieReaderConfig.FILE_GROUP_READER_ENABLED)
+        && compactionHandler.supportsFileGroupReader();
+
+    Option<CompactorBroadcastManager> broadcastManagerOpt = Option.empty();
+    // Broadcast necessary information.
+    if (useFileGroupReaderBasedCompaction) {
+      broadcastManagerOpt = getCompactorBroadcastManager(context);
+      if (broadcastManagerOpt.isPresent()) {
+        broadcastManagerOpt.get().prepareAndBroadcast();
+      }
+    }
+    final Option<CompactorBroadcastManager> finalizedBroadcastManager = 
broadcastManagerOpt;
+
     return context.parallelize(operations).map(operation -> compact(
-        compactionHandler, metaClient, config, operation, 
compactionInstantTime, maxInstantTime, instantRange, taskContextSupplier, 
executionHelper))

Review Comment:
   Let's add a new `#compact` method for the fg reader to take the new 
parameters: `CompactorBroadcastManager`, there is no necessaty to bind the 
existing/fg compaction logic in one method, so that each implementation could 
be clean.



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