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

ingester: reduce active series when series change owner #8084

Merged

Conversation

dimitarvdimitrov
Copy link
Contributor

What this PR does

Couples updates to owned series with updates to active series. If a series is no longer owned, it is no longer counted as an active series. The exception to that is during early head compaction: the series are still active even if they are removed from the head.

Which issue(s) this PR fixes or relates to

Fixes #7976

Checklist

  • Tests updated.
  • Documentation added.
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX].
  • about-versioning.md updated with experimental features.

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@pstibrany pstibrany left a comment

Choose a reason for hiding this comment

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

Looks good, thank you.

Copy link
Contributor

@pr00se pr00se left a comment

Choose a reason for hiding this comment

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

A couple nits, but otherwise LGTM. Thanks!

CHANGELOG.md Outdated
@@ -32,6 +32,7 @@
* [ENHANCEMENT] OTLP: Improve remote write format translation performance by using label set hashes for metric identifiers instead of string based ones. #8012
* [ENHANCEMENT] Querying: Remove OpEmptyMatch from regex concatenations. #8012
* [ENHANCEMENT] Store-gateway: add `-blocks-storage.bucket-store.max-concurrent-queue-timeout`. When set, queries at the store-gateway's query gate will not wait longer than that to execute. If a query reaches the wait timeout, then the querier will retry the blocks on a different store-gateway. If all store-gateways are unavailable, then the query will fail with `err-mimir-store-consistency-check-failed`. #7777
* [ENHANCEMENT] Ingester: active series are now updated along with owned series. They decrease when series change ownership between ingesters. This helps provide a more accurate total of active series when ingesters are added. #8084
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we specifically call out here that this is only enabled if the owned series flags (ingester.track-ingester-owned-series or ingester.use-ingester-owned-series-for-limits) are enabled?

Maybe it's enough to change it to "when owned series are enabled, active series are now..."?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mentioned the two flags. This makes the changelog a bit more self-sufficient to digest new changes


// since no reason set, shard size and local limit are unchanged, and we pass ringChanged=false, no recompute will happen
c.updateOwnedSeriesAndCheckResult(t, false, 0, "")
c.checkTestedIngesterOwnedSeriesState(t, ownedServiceSeriesCount, 1, ownedServiceTestUserSeriesLimit)
c.checkUpdateReasonForUser(t, "")
c.checkActiveSeriesCount(t, ownedServiceSeriesCount)

// passing ringChanged=true will trigger recompute because the token ownership has changed
c.updateOwnedSeriesAndCheckResult(t, true, 1, recomputeOwnedSeriesReasonRingChanged)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we check that active series go to 0 in this block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch; the assertion was already in the partitions test case, but I had missed it for the classic ring. See 5acfce5

pkg/ingester/owned_series_test.go Outdated Show resolved Hide resolved
dimitarvdimitrov and others added 9 commits May 15, 2024 13:39
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>
Co-authored-by: Jon Kartago Lamida <jon.lamida@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>
@dimitarvdimitrov dimitarvdimitrov force-pushed the dimitar/ingester/owned-active-series-ring-update-loop branch from e40be24 to 75e3ece Compare May 15, 2024 11:40
@dimitarvdimitrov dimitarvdimitrov enabled auto-merge (squash) May 15, 2024 11:41
@dimitarvdimitrov dimitarvdimitrov merged commit 07d5ce7 into main May 15, 2024
28 checks passed
@dimitarvdimitrov dimitarvdimitrov deleted the dimitar/ingester/owned-active-series-ring-update-loop branch May 15, 2024 11:54
francoposa pushed a commit that referenced this pull request May 27, 2024
* calculate owned active series in owned series loop

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

* Support clearing active series

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

* Update owned series tests

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

* Add test for early head compaction

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

* Add CHANGELOG.md entry

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

* Apply suggestions from code review

Co-authored-by: Jon Kartago Lamida <jon.lamida@grafana.com>

* Clarify CHANGELOG.md

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

* Add missing assertion

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

* Fix typo

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

---------

Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Co-authored-by: Jon Kartago Lamida <jon.lamida@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.

ingester: include only owned series in active series stats
4 participants