Skip to content

Commit

Permalink
Fix integer math bug in HeapUsageTracker (#6455) (#6461)
Browse files Browse the repository at this point in the history
* Fix a bug in Search Backpressure



---------


(cherry picked from commit d439244)

Signed-off-by: PritLadani <pritkladani@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 4bb8d24 commit 87a62f6
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 87a62f6

Please sign in to comment.