-
Notifications
You must be signed in to change notification settings - Fork 228
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
Conversation
There was a problem hiding this 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
core/src/main/scala/filodb.core/memstore/PartKeyLuceneIndex.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
core/src/test/scala/filodb.core/memstore/PartKeyLuceneIndexSpec.scala
Outdated
Show resolved
Hide resolved
core/src/main/scala/filodb.core/memstore/PartKeyLuceneIndex.scala
Outdated
Show resolved
Hide resolved
core/src/main/scala/filodb.core/memstore/PartKeyLuceneIndex.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
@@ -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, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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