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


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/cluster/ClusteringPlanActionExecutor.java:
##########
@@ -65,26 +65,20 @@ protected Option<HoodieClusteringPlan> 
createClusteringPlan() {
         
.findInstantsAfter(lastClusteringInstant.map(HoodieInstant::getTimestamp).orElse("0"),
 Integer.MAX_VALUE)
         .countInstants();
 
-    if (config.inlineClusteringEnabled() && 
config.getInlineClusterMaxCommits() > commitsSinceLastClustering) {
-      LOG.info("Not scheduling inline clustering as only " + 
commitsSinceLastClustering
-          + " commits was found since last clustering " + 
lastClusteringInstant + ". Waiting for "
-          + config.getInlineClusterMaxCommits());
-      return Option.empty();
-    }
+    int clusterMaxCommit = config.inlineClusteringEnabled() ? 
config.getInlineClusterMaxCommits() : config.getAsyncClusterMaxCommits();
 
-    if (config.isAsyncClusteringEnabled() && 
config.getAsyncClusterMaxCommits() > commitsSinceLastClustering) {
-      LOG.info("Not scheduling async clustering as only " + 
commitsSinceLastClustering
+    if (clusterMaxCommit > commitsSinceLastClustering) {
+      LOG.info("Not scheduling clustering as only " + 
commitsSinceLastClustering
           + " commits was found since last clustering " + 
lastClusteringInstant + ". Waiting for "
-          + config.getAsyncClusterMaxCommits());
+          + clusterMaxCommit);
       return Option.empty();

Review Comment:
   Nice catch ~, is there any possibility we can write a test case here, a 
simple UT should be fine.



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