github-advanced-security[bot] commented on code in PR #16748: URL: https://github.com/apache/druid/pull/16748#discussion_r1687226541
########## processing/src/main/java/org/apache/druid/java/util/common/guava/ParallelMergeCombiningSequence.java: ########## @@ -367,10 +388,10 @@ catch (Throwable t) { closeAllCursors(sequenceCursors); cancellationGizmo.cancel(t); - // Should be the following, but can' change due to lack of - // unit tests. - // out.offer((ParallelMergeCombiningSequence.ResultBatch<T>) ResultBatch.TERMINAL); - out.offer(ResultBatch.TERMINAL); + // offer terminal result if queue is not full in case out is empty to allow downstream threads waiting on + // stuff to be present to stop blocking immediately. However, if the queue is full, it doesn't matter if we + // write anything because the cancellation signal has been set, which will also terminate processing. + out.offer(ResultBatch.terminal()); Review Comment: ## Ignored error status of call Method compute ignores exceptional return value of BlockingQueue<ResultBatch<T>>.offer. [Show more details](https://github.com/apache/druid/security/code-scanning/7582) ########## processing/src/test/java/org/apache/druid/java/util/common/guava/ParallelMergeCombiningSequenceTest.java: ########## @@ -211,16 +211,18 @@ if (!currentBatch.isDrained()) { outputQueue.offer(currentBatch); } - outputQueue.offer(ParallelMergeCombiningSequence.ResultBatch.TERMINAL); + outputQueue.offer(ParallelMergeCombiningSequence.ResultBatch.terminal()); Review Comment: ## Ignored error status of call Method testOrderedResultBatchFromSequenceToBlockingQueueCursor ignores exceptional return value of ArrayBlockingQueue<ResultBatch<IntPair>>.offer. [Show more details](https://github.com/apache/druid/security/code-scanning/7587) ########## processing/src/test/java/org/apache/druid/java/util/common/guava/ParallelMergeCombiningSequenceTest.java: ########## @@ -143,7 +143,7 @@ if (!currentBatch.isDrained()) { outputQueue.offer(currentBatch); } - outputQueue.offer(ParallelMergeCombiningSequence.ResultBatch.TERMINAL); + outputQueue.offer(ParallelMergeCombiningSequence.ResultBatch.terminal()); Review Comment: ## Ignored error status of call Method testOrderedResultBatchFromSequenceBacktoYielderOnSequence ignores exceptional return value of ArrayBlockingQueue<ResultBatch<IntPair>>.offer. [Show more details](https://github.com/apache/druid/security/code-scanning/7585) ########## processing/src/main/java/org/apache/druid/java/util/common/guava/ParallelMergeCombiningSequence.java: ########## @@ -828,6 +867,11 @@ throw new RuntimeException("Failed to offer result to output queue", e); } } + + public void tryOfferTerminal() + { + this.queue.offer(ResultBatch.terminal()); Review Comment: ## Ignored error status of call Method tryOfferTerminal ignores exceptional return value of BlockingQueue<ResultBatch<E>>.offer. [Show more details](https://github.com/apache/druid/security/code-scanning/7583) -- 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: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org