Repository navigation
minor: Complete CollectedAsyncResource immediately on failure. - #20504
Conversation
Rather than waiting for all source resources to complete, we can immediately complete the target resource if any source resource fails. This prevents doing needless work gathering up all the other resources, and allows them to be closed (and therefore potentially canceled) more quickly.
FrankChen021
left a comment
There was a problem hiding this comment.
🟢 Approval recommended
No actionable correctness or lifecycle issues found. The failure callback propagates a source error promptly while leaving the remaining sources owned by the collected resource; successful collection still returns values in source order. I also inspected the async resource callback and close behavior, the transform and recovery combinators, and all production call sites of AsyncResources.collect.
Reviewed all 4 of 4 changed files: processing/src/main/java/org/apache/druid/common/asyncresource/AsyncResources.java, processing/src/main/java/org/apache/druid/common/asyncresource/CollectAsyncResource.java, processing/src/test/java/org/apache/druid/common/asyncresource/AsyncResourcesTest.java, and processing/src/test/java/org/apache/druid/common/asyncresource/CollectAsyncResourceTest.java.
Validation: git diff --check a38a81f1ce309b6bddb0300715b6e63d13772cf6...HEAD passed. Static review only; tests were not run.
This is an automated review by Codex GPT-5.6-Luna(max)
Rather than waiting for all source resources to complete, we can immediately complete the target resource if any source resource fails. This prevents doing needless work gathering up all the other resources, and allows them to be closed (and therefore potentially canceled) more quickly.