fhan688 commented on code in PR #12518:
URL: https://github.com/apache/hudi/pull/12518#discussion_r1899354718
##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/bulk/BulkInsertWriterHelper.java:
##########
@@ -157,9 +165,25 @@ private HoodieRowDataCreateHandle
getRowCreateHandle(String partitionPath) throw
}
public void close() throws IOException {
- for (HoodieRowDataCreateHandle rowCreateHandle : handles.values()) {
- LOG.info("Closing bulk insert file " + rowCreateHandle.getFileName());
- writeStatusList.add(closeWriteHandle(rowCreateHandle));
+ ExecutorService executorService =
Executors.newFixedThreadPool(handles.size());
+ allOf(handles.values().stream()
+ .map(rowCreateHandle -> CompletableFuture.supplyAsync(() -> {
+ try {
+ LOG.info("Closing bulk insert file " +
rowCreateHandle.getFileName());
+ return rowCreateHandle.close();
+ } catch (IOException e) {
+ throw new HoodieIOException("IOE during rowCreateHandle.close()",
e);
+ }
+ }, executorService))
+ .collect(Collectors.toList())
+ ).whenComplete((result, throwable) -> {
+ writeStatusList.addAll(result);
+ }).join();
+ try {
+ executorService.shutdown();
+ executorService.awaitTermination(24, TimeUnit.DAYS);
Review Comment:
Teacher Danny, PTAL @danny0405
--
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]