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

feat #6679: add series limit config setting #7095

Merged
merged 2 commits into from
Aug 5, 2016
Merged

Conversation

dgnorton
Copy link
Contributor

@dgnorton dgnorton commented Jul 29, 2016

This PR adds a configurable limit on the number of series per database.

/cc @jwilder

Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated

@mention-bot
Copy link

@dgnorton, thanks for your PR! By analyzing the annotation information on this pull request, we identified @e-dard to be a potential reviewer

@dgnorton dgnorton force-pushed the dgn-cardinality-limits branch 2 times, most recently from 9be3b9c to 519407e Compare July 29, 2016 03:38
@@ -452,6 +452,10 @@ func (s *Shard) validateSeriesAndFields(points []models.Point) ([]*FieldCreate,
key := string(p.Key())
ss := s.index.Series(key)
if ss == nil {
if len(s.index.series)-1 > s.options.Config.MaxSeriesPerDatabase {
return nil, fmt.Errorf("would exceed series limit: %s", key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "max series per database exceeded" which similar to https://github.com/influxdata/influxdb/blob/master/tsdb/engine/tsm1/cache.go#L18

@dgnorton dgnorton force-pushed the dgn-cardinality-limits branch from 519407e to 5a11386 Compare July 29, 2016 03:49
@@ -57,6 +60,9 @@ type Config struct {
CompactFullWriteColdDuration toml.Duration `toml:"compact-full-write-cold-duration"`
MaxPointsPerBlock int `toml:"max-points-per-block"`

// Limits
MaxSeriesPerDatabase int `toml:"max-series-per-database"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add docs that describe the behavior of this option and and that 0 disables it. Something like:

MaxSeriesPerDatabase is the maximum number of series a node hold per database. When this limit is exceeded, writes return a max series per database exceeded error. A value of 0 disables the limit.

@jwilder
Copy link
Contributor

jwilder commented Jul 29, 2016

Needs changelog entry under features and a note in the release notes section that states that a default limit of 1M per database is in place and may need to be disabled by setting it to 0 or increased.

@jwilder
Copy link
Contributor

jwilder commented Jul 29, 2016

A test for this would be good as well.

@dgnorton dgnorton force-pushed the dgn-cardinality-limits branch 4 times, most recently from 60183a8 to 2b89808 Compare July 29, 2016 04:42
@dgnorton dgnorton force-pushed the dgn-cardinality-limits branch from 2b89808 to 0c45597 Compare August 1, 2016 12:29
@jwilder jwilder added this to the 1.0.0 milestone Aug 4, 2016
@jsternberg
Copy link
Contributor

While testing this with a very low number, I'm getting errors from the monitor service. Maybe we should exclude the monitor service from this limit since we control that one?

Also, is this limit supposed to be per-measurement or is it for the entire database? The PR says database and that seems to be where the limit is, I just wanted to make sure.

@jsternberg
Copy link
Contributor

jsternberg commented Aug 5, 2016

Other than the things I just mentioned, it seems to work locally for me. I tested writing enough series to hit the limit, then lowering the limit and rebooting the server to see if it would still load all of the series that had already been written.

@@ -6,6 +6,7 @@
* Support for config options `[collectd]` and `[opentsdb]` has been removed; use `[[collectd]]` and `[[opentsdb]]` instead.
* Config option `data-logging-enabled` within the `[data]` section, has been renamed to `trace-logging-enabled`, and defaults to `false`.
* The keywords `IF`, `EXISTS`, and `NOT` where removed for this release. This means you no longer need to specify `IF NOT EXISTS` for `DROP DATABASE` or `IF EXISTS` for `CREATE DATABASE`.
* `max-series-per-database` was added with a default of 1M but can be disabled by setting it to `0`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we break this out in a separate Breaking Changes section? It should clearly state that if you upgrade and have more than 1M series, you will need to modify your config before upgrading or writes will fail:

[data]
max-series-per-database = 0  # 0 to disable

Copy link
Contributor

Choose a reason for hiding this comment

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

As a side note, I made sure to test that. If you have over 1M series, you'll still be able to start up, you just won't be able to add new series.

@dgnorton
Copy link
Contributor Author

dgnorton commented Aug 5, 2016

@jsternberg re trying to manage the monitor service separate, I think it's better for the user to account for that in the series limit setting or, if the system is extremely resource-constrained, disable the monitor service.

@jwilder
Copy link
Contributor

jwilder commented Aug 5, 2016

👍

@dgnorton dgnorton merged commit 064db3c into master Aug 5, 2016
@dgnorton dgnorton deleted the dgn-cardinality-limits branch August 5, 2016 20:34
@jwilder jwilder mentioned this pull request Aug 9, 2016
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.

4 participants