Skip to content

Commit ecc930c

Browse files
committed
CB change need hasFailure pre-check
it's not idempotent and may be called by non-synchronized thread like tryExecuteNext Signed-off-by: bowenlan-amzn <[email protected]>
1 parent 0f48443 commit ecc930c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/src/main/java/org/opensearch/action/search/QueryPhaseResultConsumer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,19 @@ private void sortBuffer() {
342342
}
343343

344344
private synchronized long addWithoutBreaking(long size) {
345+
if (hasFailure()) {
346+
return circuitBreakerBytes;
347+
}
345348
circuitBreaker.addWithoutBreaking(size);
346349
circuitBreakerBytes += size;
347350
maxAggsCurrentBufferSize = Math.max(maxAggsCurrentBufferSize, circuitBreakerBytes);
348351
return circuitBreakerBytes;
349352
}
350353

351354
private synchronized long addEstimateAndMaybeBreak(long estimatedSize) {
355+
if (hasFailure()) {
356+
return circuitBreakerBytes;
357+
}
352358
circuitBreaker.addEstimateBytesAndMaybeBreak(estimatedSize, "<reduce_aggs>");
353359
circuitBreakerBytes += estimatedSize;
354360
maxAggsCurrentBufferSize = Math.max(maxAggsCurrentBufferSize, circuitBreakerBytes);

0 commit comments

Comments
 (0)