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

misc(query): limit partKey/partId lookup results early #1692

Merged
merged 4 commits into from
Dec 8, 2023

Conversation

sherali42
Copy link
Contributor

Pull Request checklist

  • The commit(s) message(s) follows the contribution guidelines ?

  • Tests for the changes have been added (for bug fixes / features) ?

  • Stop collecting results once limit is hit. This will avoid unnecessary cpu cycles and heap usage

alextheimer
alextheimer previously approved these changes Dec 7, 2023
Copy link
Contributor

@alextheimer alextheimer left a comment

Choose a reason for hiding this comment

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

Excellent catch @sherali42 @amolnayak311

sandeep6189
sandeep6189 previously approved these changes Dec 7, 2023
Copy link
Contributor

@sandeep6189 sandeep6189 left a comment

Choose a reason for hiding this comment

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

Thanks a bunch @sherali42 @amolnayak311 . This will definitely help protect the system with runaway queries

sandeep6189
sandeep6189 previously approved these changes Dec 7, 2023
Copy link
Contributor

@amolnayak311 amolnayak311 left a comment

Choose a reason for hiding this comment

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

LGTM, left a couple of comments. Thanks for the PR @sherali42

@sherali42 sherali42 merged commit 0a91fd8 into filodb:develop Dec 8, 2023
1 check passed
sherali42 added a commit to sherali42/FiloDB that referenced this pull request Dec 9, 2023
@@ -901,8 +901,9 @@ class PartKeyLuceneIndex(ref: DatasetRef,
//scalastyle:on method.length
def partIdsFromFilters(columnFilters: Seq[ColumnFilter],
startTime: Long,
endTime: Long): debox.Buffer[Int] = {
val collector = new PartIdCollector() // passing zero for unlimited results
endTime: Long,
Copy link
Member

Choose a reason for hiding this comment

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

Can you remove the limit from this and all the partId collectors ? This specific method is used in regular PromQL queries and it should not silently limit. The data could be aggregated

Copy link
Member

Choose a reason for hiding this comment

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

Never mind - the default value for that param I see is Int.MaxValue, and PromQL API path is not passing in any value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants