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

store-gateway series: break up fetching of series into functions #3540

Merged

Conversation

dimitarvdimitrov
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov commented Nov 28, 2022

This PR only moves code out of the Series method. It moved two functions -
one that queries all blocks and one that updates metrics of the
store-gateway from the stats of each Series method call

Comment on lines -983 to -976
s.metrics.seriesGetAllDuration.Observe(stats.getAllDuration.Seconds())
s.metrics.seriesBlocksQueried.Observe(float64(stats.blocksQueried))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was also moved to recordSeriesCallResult

@pracucci pracucci self-requested a review November 28, 2022 13:57
@dimitarvdimitrov dimitarvdimitrov force-pushed the dimitar/scplit-series-collection-from-series-sending branch from 67eaa19 to ec5e732 Compare November 28, 2022 13:59
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
@@ -840,10 +840,8 @@ func (s *BucketStore) Series(req *storepb.SeriesRequest, srv storepb.Store_Serie

var (
ctx = srv.Context()
stats = &queryStats{}
stats *queryStats
Copy link
Contributor

Choose a reason for hiding this comment

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

is this declaration necessary? It just gets re-declared further down

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should have been fixed with 0f75572

dimitarvdimitrov added a commit that referenced this pull request Nov 28, 2022
Series() acquires a per-tenant lock when starting to read from a block.
The reason is to prevent a race between addBlock, removeBlock, and
reading from these blocks (for example a block is unloaded after Series
() has already selected it for querying; when accessing this block's
index header we will be using an mmaped file which was deleted from
disk).

This PR moves this locking outside of Series() so we can use further
simplify the code in PR 3540 (see [comment](#3540 (comment)))

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
dimitarvdimitrov added a commit that referenced this pull request Nov 28, 2022
Series() acquires a per-tenant lock when starting to read from a block.
The reason is to prevent a race between addBlock, removeBlock, and
reading from these blocks (for example a block is unloaded after Series
() has already selected it for querying; when accessing this block's
index header we will be using an mmaped file which was deleted from
disk).

This PR moves this locking outside of Series() so we can use further
simplify the code in PR 3540 (see [comment](#3540 (comment)))

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
This PR only moves code out of the Series method. It moved two functions
 - one that queries all blocks and one that updates metrics of the
 store-gateway from the stats of each Series method call

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
@dimitarvdimitrov dimitarvdimitrov force-pushed the dimitar/scplit-series-collection-from-series-sending branch from 0f75572 to 1f015ec Compare November 28, 2022 18:02
Copy link
Collaborator

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

Good job, overall LGTM! I left few minor things I would like to see fixed before we merge. Thanks!

pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
pkg/storegateway/bucket.go Outdated Show resolved Hide resolved
dimitarvdimitrov and others added 6 commits November 29, 2022 11:54
Co-authored-by: Marco Pracucci <marco@pracucci.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Copy link
Collaborator

@pracucci pracucci 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!

@dimitarvdimitrov dimitarvdimitrov enabled auto-merge (squash) November 29, 2022 11:56
@dimitarvdimitrov dimitarvdimitrov merged commit 30f0361 into main Nov 29, 2022
@dimitarvdimitrov dimitarvdimitrov deleted the dimitar/scplit-series-collection-from-series-sending branch November 29, 2022 12:05
masonmei pushed a commit to udmire/mimir that referenced this pull request Dec 16, 2022
Series() acquires a per-tenant lock when starting to read from a block.
The reason is to prevent a race between addBlock, removeBlock, and
reading from these blocks (for example a block is unloaded after Series
() has already selected it for querying; when accessing this block's
index header we will be using an mmaped file which was deleted from
disk).

This PR moves this locking outside of Series() so we can use further
simplify the code in PR 3540 (see [comment](grafana#3540 (comment)))

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
masonmei pushed a commit to udmire/mimir that referenced this pull request Dec 16, 2022
…fana#3540)

This PR only moves code out of the Series method. It moves two functions - 
one that queries all blocks and one that updates metrics of the
store-gateway from the stats of each Series method call

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants