dongxiaoman commented on a change in pull request #8272:
URL: https://github.com/apache/pinot/pull/8272#discussion_r817273861
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/StreamingReduceService.java
##########
@@ -127,23 +131,29 @@ private static void
processIterativeServerResponse(StreamingReducer reducer, Exe
aggregator.aggregate(entry.getKey(), dataTable);
}
}
+ return null;
} catch (Exception e) {
+ LOGGER.error("Unable to process streaming response. Failure
occurred!", e);
throw new RuntimeException("Unable to process streaming response.
Failure occurred!", e);
- } finally {
- countDownLatch.countDown();
}
});
}
-
- try {
- countDownLatch.await(reduceTimeOutMs, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- for (Future future : futures) {
- if (!future.isDone()) {
- future.cancel(true);
+ for (int received = 0; received < futures.length; received++) {
+ try {
+ Future<Void> rpcCallHandle = countDownHelper.poll(reduceTimeOutMs,
TimeUnit.MILLISECONDS);
+ if (rpcCallHandle == null) {
+ throw new TimeoutException("Failed to complete gRPC call within " +
reduceTimeOutMs + "ms.");
+ }
+ // below will force the thread exception thrown into current thread
+ rpcCallHandle.get(reduceTimeOutMs, TimeUnit.MILLISECONDS);
Review comment:
@Jackie-Jiang By a quick code search, seems many places with
`CountDownLatch` has similar pattern. They need to call `future.get()` to force
the thread exception to throw, otherwise the calling thread (the one submitting
the task) will consider the future success.
Example are
https://github.com/apache/pinot/blob/b8fecb9d5a8fe524c42e29ce99ccf5012a2ebd49/pinot-core/src/main/java/org/apache/pinot/core/query/reduce/GroupByDataTableReducer.java#L386
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]