You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/09/13 07:49:04 UTC

[GitHub] [hudi] eric9204 commented on a diff in pull request #6574: [HUDI-4814] Schedules new clustering plan based on latest clustering instant

eric9204 commented on code in PR #6574:
URL: https://github.com/apache/hudi/pull/6574#discussion_r969267905


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/cluster/ClusteringPlanActionExecutor.java:
##########
@@ -48,21 +48,28 @@
   private final Option<Map<String, String>> extraMetadata;
 
   public ClusteringPlanActionExecutor(HoodieEngineContext context,
-                                          HoodieWriteConfig config,
-                                          HoodieTable<T, I, K, O> table,
-                                          String instantTime,
-                                          Option<Map<String, String>> extraMetadata) {
+                                      HoodieWriteConfig config,
+                                      HoodieTable<T, I, K, O> table,
+                                      String instantTime,
+                                      Option<Map<String, String>> extraMetadata) {
     super(context, config, table, instantTime);
     this.extraMetadata = extraMetadata;
   }
 
   protected Option<HoodieClusteringPlan> createClusteringPlan() {
     LOG.info("Checking if clustering needs to be run on " + config.getBasePath());
-    Option<HoodieInstant> lastClusteringInstant = table.getActiveTimeline().getCompletedReplaceTimeline().lastInstant();
+    Option<HoodieInstant> lastClusteringInstant;
+    Option<HoodieInstant> pendingInstant = table.getActiveTimeline().filterPendingReplaceTimeline().lastInstant();
+    if (pendingInstant.isPresent()) {

Review Comment:
   > ```java
   > table.getActiveTimeline().getInstants.()stream().filter(
   >         s -> s.getAction().equals(HoodieTimeline.REPLACE_COMMIT_ACTION)
   > ```
   > 
   > guess we can filter the instants directly by the action type here ?
   
   @danny0405 good idea,I'm working on it.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org