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/24 06:45:35 UTC

[GitHub] [hudi] danny0405 commented on a change in pull request #4037: [HUDI-2794] Guarding table service commits within a single lock to commit to both data table and metadata table

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



##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/SparkRDDWriteClient.java
##########
@@ -386,9 +396,13 @@ private void completeClustering(HoodieReplaceCommitMetadata metadata, JavaRDD<Wr
       throw new HoodieClusteringException("Clustering failed to write to files:"
           + writeStats.stream().filter(s -> s.getTotalWriteErrors() > 0L).map(s -> s.getFileId()).collect(Collectors.joining(",")));
     }
-    writeTableMetadata(table, metadata, new HoodieInstant(HoodieInstant.State.INFLIGHT, HoodieTimeline.REPLACE_COMMIT_ACTION, clusteringCommitTime));
-    finalizeWrite(table, clusteringCommitTime, writeStats);
     try {
+      HoodieInstant clusteringInstant = new HoodieInstant(HoodieInstant.State.INFLIGHT, HoodieTimeline.REPLACE_COMMIT_ACTION, clusteringCommitTime);
+      if (config.isMetadataTableEnabled()) { // when metadata is not enabled, we don't want to take a lock here even with multi-writers.
+        this.txnManager.beginTransaction(Option.of(clusteringInstant), Option.empty());

Review comment:
       Can we also fix `HoodieFlinkWriteClient` ?




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