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/04/09 05:55:59 UTC

[GitHub] [hudi] yihua commented on a diff in pull request #5269: [HUDI-3636] Create new write clients for async table services in DeltaStreamer

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


##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/HoodieSparkClusteringClient.java:
##########
@@ -53,11 +53,15 @@ public void cluster(HoodieInstant instant) throws IOException {
     SparkRDDWriteClient<T> writeClient = (SparkRDDWriteClient<T>) clusteringClient;
     Option<HoodieCommitMetadata> commitMetadata = writeClient.cluster(instant.getTimestamp(), true).getCommitMetadata();
     Stream<HoodieWriteStat> hoodieWriteStatStream = commitMetadata.get().getPartitionToWriteStats().entrySet().stream().flatMap(e ->
-            e.getValue().stream());
+        e.getValue().stream());
     long errorsCount = hoodieWriteStatStream.mapToLong(HoodieWriteStat::getTotalWriteErrors).sum();
     if (errorsCount > 0) {
       // TODO: Should we treat this fatal and throw exception?
       LOG.error("Clustering for instant (" + instant + ") failed with write errors");
     }
+    if (writeClient != clusteringClient) {
+      // Clustering write client has been updated with new schema, closing the old one
+      writeClient.close();

Review Comment:
   Right.  I've fixed the logic to consider such cases so that the old write client is properly closed in all cases.



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