Skip to content

Commit

Permalink
Fix a bug in Search Backpressure
Browse files Browse the repository at this point in the history
Signed-off-by: PritLadani <pritkladani@gmail.com>
  • Loading branch information
PritLadani committed Feb 23, 2023
1 parent 01466a6 commit 7e76ecd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static boolean isHeapTrackingSupported() {
*/
public static boolean isHeapUsageDominatedBySearch(List<CancellableTask> cancellableTasks, double heapPercentThreshold) {
long usage = cancellableTasks.stream().mapToLong(task -> task.getTotalResourceStats().getMemoryInBytes()).sum();
long threshold = (long) heapPercentThreshold * HEAP_SIZE_BYTES;
long threshold = (long) (heapPercentThreshold * HEAP_SIZE_BYTES);
if (isHeapTrackingSupported() && usage < threshold) {
logger.debug("heap usage not dominated by search requests [{}/{}]", usage, threshold);
return false;
Expand Down

0 comments on commit 7e76ecd

Please sign in to comment.