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 02:38:04 UTC

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

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


##########
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:
   guess, we could miss to close the old write client if there is no clustering inflight. i.e. when async clustering thread is just waiting and if write client is updated (due to schema change), we might over ride w/ new write client and we may not close the old one. Can we ensure we close it out 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