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

Limit series count in selection #6102

Merged
merged 2 commits into from
Mar 23, 2016

Conversation

benbjohnson
Copy link
Contributor

Overview

This pull request adds a configurable limit to the number of series that can be returned from a SELECT statement. The limit is checked immediately after planning and is determined by the use of iterator stats.

Fixes #6076


  • CHANGELOG.md updated
  • Rebased/mergable
  • Tests pass
  • Sign CLA (if not already signed)

@benbjohnson benbjohnson added this to the 0.12.0 milestone Mar 23, 2016
@benbjohnson
Copy link
Contributor Author

/cc @jwilder @jsternberg

@@ -463,6 +466,12 @@ func (e *QueryExecutor) executeSelectStatement(stmt *influxql.SelectStatement, c
em.OmitTime = stmt.OmitTime
defer em.Close()

// Calculate initial stats across all iterators.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be before creating the emitter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The emitter is handling the closing of the iterators so I didn't want to do a double defer close. Really, the iterators should close themselves but that's a change for a different PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course. Never mind.

@benbjohnson
Copy link
Contributor Author

I originally added the limit to meta.Database but once I got to the query limits itself I realized that we can do multi-database queries and it gets really hairy from there.

This PR is a WIP because I need to know how we want to specify this parameter. I can think of two ways:

  • Server-level: no queries can exceed a given number of series. This would be specified in the config.
  • User-level: specify the MaxSelectSeriesN on a meta.User. This would need InfluxQL language support.

@benbjohnson
Copy link
Contributor Author

Limit added to server configuration.

This commit adds a buffer for stats to be updated without
requiring a mutex lock/unlock on every point. The tradeoff
is that stats are not exactly precise. This works for our
use case because stats are only periodically checked.
This commit adds a configurable limit to the number of series that
can be returned from a `SELECT` statement. The limit is checked
immediately after planning and is determined by the use of iterator
stats.

Fixes influxdata#6076
@benbjohnson benbjohnson merged commit 5e8e849 into influxdata:master Mar 23, 2016
@benbjohnson benbjohnson deleted the limit-series branch March 23, 2016 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants