Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in Search Backpressure #6455

Merged
merged 4 commits into from
Feb 23, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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);
Copy link
Member

@dreamer-89 dreamer-89 Feb 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Good to have one unit test which verifies this change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PritLadani Can you add unit tests here in a follow up PR? This is a public static method and should be pretty straightforward to unit test.

Done here. #6463
Thanks!

if (isHeapTrackingSupported() && usage < threshold) {
logger.debug("heap usage not dominated by search requests [{}/{}]", usage, threshold);
return false;