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 2021/11/16 15:58:17 UTC

[GitHub] [hudi] vinothchandar commented on a change in pull request #3869: [HUDI-1937] Rollback unfinished replace commit to allow updates

vinothchandar commented on a change in pull request #3869:
URL: https://github.com/apache/hudi/pull/3869#discussion_r750406314



##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/BaseSparkCommitActionExecutor.java
##########
@@ -117,7 +119,29 @@ private void initKeyGenIfNeeded(boolean populateMetaFields) {
           table.getFileSystemView().getFileGroupsInPendingClustering().map(entry -> entry.getKey()).collect(Collectors.toSet());
       UpdateStrategy updateStrategy = (UpdateStrategy)ReflectionUtils
           .loadClass(config.getClusteringUpdatesStrategyClass(), this.context, fileGroupsInPendingClustering);
-      return (JavaRDD<HoodieRecord<T>>)updateStrategy.handleUpdate(inputRecordsRDD);
+      Pair<JavaRDD<HoodieRecord<T>>, Set<HoodieFileGroupId>> recordsAndPendingClusteringFileGroups =
+          (Pair<JavaRDD<HoodieRecord<T>>, Set<HoodieFileGroupId>>)updateStrategy.handleUpdate(inputRecordsRDD);
+      Set<HoodieFileGroupId> fileGroupsWithUpdatesAndPendingClustering = recordsAndPendingClusteringFileGroups.getRight();
+      if (fileGroupsWithUpdatesAndPendingClustering.isEmpty()) {
+        return recordsAndPendingClusteringFileGroups.getLeft();
+      }
+      // there are filegroups pending clustering and receiving updates, so rollback the pending clustering instants
+      try {
+        this.txnManager.beginTransaction();

Review comment:
       we want to keep all locking to the write client during commit at the same place. 




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