cshuo opened a new pull request, #20045:
URL: https://github.com/apache/hudi/pull/20045
### Describe the issue this Pull Request addresses
When one Flink bulk-insert handle fails to close, `FutureUtils.allOf()`
cancels unfinished futures. Queued close tasks can consequently be skipped,
leaving their handles unclosed. The failing `join()` also skips the executor
shutdown, and the unconditional completion callback attempts to collect a null
result.
### Summary and Changelog
- Use JDK `CompletableFuture.allOf()` to wait for every submitted close
attempt before propagating a failure, without cancelling queued tasks.
- Always shut down the executor in `finally`, and collect write statuses and
clear handles only after all closes succeed.
- Extract the asynchronous single-handle close into `closeAsync()`.
- Add regression coverage for queued tasks after both checked and runtime
close failures, exception preservation, executor shutdown, and repeated
successful close calls.
Validation: `TestBulkInsertWriteHelper` passed all 15 tests with Flink 1.20;
Checkstyle passed.
```bash
mvn -Pflink1.20 -pl hudi-flink-datasource/hudi-flink -am \
-Dtest=TestBulkInsertWriteHelper \
-Dsurefire.failIfNoSpecifiedTests=false \
-DskipITs -DskipSparkTests -DskipScalaTests test
```
### Impact
Improves cleanup in `BulkInsertWriterHelper.close()` when a handle fails.
Parallelism remains capped at 10. No public API or configuration changes. File
rolling and operator lifecycle cleanup are outside this change.
### Risk Level
Low. The failure path now waits for every close attempt before reporting an
error, so reporting can take longer when another handle is slow to close.
Regression tests verify that queued tasks execute and the executor is shut
down. Failure injection uses mocked handles; storage-specific failure behavior
and other Flink versions were not tested.
### Documentation Update
None.
### Contributor's checklist
- [ ] Read through [contributor's
guide](https://hudi.apache.org/contribute/how-to-contribute)
- [x] Enough context is provided in the sections above
- [x] Adequate tests were added if applicable
--
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]