shangxinli commented on code in PR #20429:
URL: https://github.com/apache/hudi/pull/20429#discussion_r4444138504
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/streamer/StreamSync.java:
##########
@@ -1247,13 +1247,18 @@ private void reInitWriteClient(HoodieSchema
sourceSchema, HoodieSchema targetSch
}
}
- if (writeClient != null) {
- // Close Write client.
- writeClient.close();
- }
KeyGenUtils.recordComplexKeygenEncodingIfMissing(metaClient, writeConfig);
+ SparkRDDWriteClient previousWriteClient = writeClient;
writeClient = new SparkRDDWriteClient<>(hoodieSparkContext, writeConfig,
embeddedTimelineService);
- onInitializingHoodieWriteClient.apply(writeClient);
+ // Switch the async table services before closing the previous client.
Each handoff waits for any active run
+ // to finish, so no compaction or clustering is still using the previous
client when it is closed.
+ try {
+ onInitializingHoodieWriteClient.apply(writeClient);
Review Comment:
reInitWriteClient now closes the previous write client only after
onInitializingHoodieWriteClient.apply(writeClient) returns. Worth confirming
that callback synchronously finishes handing off the async compaction and
clustering services to the new client before returning, otherwise there's a
brief window where both clients' table services could be live at once.
--
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]