yihua commented on code in PR #7035:
URL: https://github.com/apache/hudi/pull/7035#discussion_r1015761600


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/BaseHoodieWriteClient.java:
##########
@@ -588,6 +588,19 @@ protected void runTableServicesInline(HoodieTable table, 
HoodieCommitMetadata me
         
metadata.addMetadata(HoodieClusteringConfig.SCHEDULE_INLINE_CLUSTERING.key(), 
"true");
         inlineScheduleClustering(extraMetadata);
       }
+
+      // if clustering is disabled, but we might need to rollback any inflight 
clustering when clustering was enabled previously.
+      if (!config.inlineClusteringEnabled() && 
!config.isAsyncClusteringEnabled() && !config.scheduleInlineClustering()
+          && config.isRollbackPendingClustering()) {
+        // rollback any pending clustering
+        
table.getActiveTimeline().filterPendingReplaceTimeline().getInstants().forEach(instant
 -> {
+          Option<Pair<HoodieInstant, HoodieClusteringPlan>> instantPlan = 
ClusteringUtils.getClusteringPlan(table.getMetaClient(), instant);
+          if (instantPlan.isPresent()) {
+            LOG.info("Rolling back pending clustering at instant " + 
instantPlan.get().getLeft());
+            rollback(instant.getTimestamp());

Review Comment:
   This issue exists today, but before this PR, there should not be a pending 
rollback for a clustering instant, so it was not a problem.  Only when this PR 
introduces the rollback of a clustering instant, it becomes an issue, and the 
metadata table can still be blocked by such a pending rollback.  So that should 
be fixed in this PR without introducing new problems.



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