danny0405 commented on a change in pull request #4463:
URL: https://github.com/apache/hudi/pull/4463#discussion_r776575452



##########
File path: 
hudi-flink/src/main/java/org/apache/hudi/sink/compact/CompactionCommitSink.java
##########
@@ -108,8 +124,15 @@ public void invoke(CompactionCommitEvent event, Context 
context) throws Exceptio
    * @param events  Commit events ever received for the instant
    */
   private void commitIfNecessary(String instant, 
Collection<CompactionCommitEvent> events) throws IOException {
-    HoodieCompactionPlan compactionPlan = CompactionUtils.getCompactionPlan(
-        this.writeClient.getHoodieTable().getMetaClient(), instant);
+    HoodieCompactionPlan compactionPlan;
+    if (compactionPlanCache.containsKey(instant)) {
+      compactionPlan = compactionPlanCache.get(instant);
+    } else {
+      compactionPlan = CompactionUtils.getCompactionPlan(
+          this.table.getMetaClient(), instant);
+      compactionPlanCache.put(instant, compactionPlan);

Review comment:
       Got your idea, can we use `computeIfAbsent` 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: [email protected]

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


Reply via email to