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

created lru cache in querysharding pkg #5749

Merged
merged 15 commits into from
Oct 12, 2022
Merged

Conversation

Rahulkumar2002
Copy link
Contributor

Signed-off-by: Rahul Kumar Jha rahuljhakumar1600@gmail.com

Changes

Added a LRU cache in analyzer.go which is in querysharding pkg.
#5715

for _, v := range value {
b.Run(fmt.Sprintf("query: %s", v.name), func(b *testing.B) {
for i := 0; i < b.N; i++ {
analyze.Analyze(v.expression)
Copy link

Choose a reason for hiding this comment

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

errcheck: Error return value of analyze.Analyze is not checked


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer_test.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer_test.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
@pull-request-size pull-request-size bot added size/M and removed size/L labels Oct 2, 2022
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 6, 2022
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
@pull-request-size pull-request-size bot added size/M and removed size/L labels Oct 6, 2022
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
pkg/queryfrontend/roundtrip.go Outdated Show resolved Hide resolved
pkg/queryfrontend/roundtrip.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer_test.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/querysharding/analyzer.go Outdated Show resolved Hide resolved
pkg/queryfrontend/roundtrip.go Outdated Show resolved Hide resolved
pkg/queryfrontend/roundtrip.go Outdated Show resolved Hide resolved
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
pkg/queryfrontend/shard_query.go Outdated Show resolved Hide resolved
Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
@yeya24 yeya24 enabled auto-merge (squash) October 12, 2022 18:29
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution

@yeya24 yeya24 merged commit 4730ae9 into thanos-io:main Oct 12, 2022
utukJ pushed a commit to utukJ/thanos that referenced this pull request Oct 13, 2022
* created lru cache in querysharding pkg

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* triggering linting & vetting

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* added cache in querysharding pkg

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* created CacheQueryAnalyzer in querysharding pkg

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* changed type of queryAnalyzer in queryfrontend pkg

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* cache in querysharding pkg with error

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* cache in querysharding pkg with error

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* removed typos in comments in analyzer.go

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* removed typos in comments in analyzer.go

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* cached queryanalyzer

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* cached query analysis in querysharding pkg

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* changed interface name from Analyze to Analyzer in analyzer.go

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

* changed struct to interface in shard_query.go

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>

Signed-off-by: Rahul Kumar Jha <rahuljhakumar1600@gmail.com>
Signed-off-by: utukj <utukphd@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants