Commit Graph

420 Commits (8825cd5d50ed575152a3d9148465d990782fba9d)

Author SHA1 Message Date
Stuart Carnie 6f0cf049ca feat: Port shard precreation service from InfluxDB 1.x
Provides new configuration parameters:

```
--storage-shard-precreator-advance-period
--storage-shard-precreator-check-interval
```

Closes #19520
2020-09-09 13:34:22 -07:00
Stuart Carnie e265f60b55 fix: Improvements in response to PR feedback
* Pass context.Context to Service.Open
* Remove redundant comments
* Bind to retention.Config configuration to be consistent with 1.x
2020-09-09 10:32:06 -07:00
Stuart Carnie 7c2be6e780 feat: Port 1.x retention policy enforcement service
Configuration of the check interval is available via

```
--storage-retention-check-interval
```

Closes #19309
2020-09-09 10:32:06 -07:00
Stuart Carnie b3138d2ead
fix: Ensure TemporaryEngine returns new inner TSDB store 2020-09-01 10:50:44 -07:00
Stuart Carnie a607ac30b9
chore: Re-enable `TemporaryEngine` via `--e2e-testing` 2020-08-31 13:50:20 -07:00
Brett Buddin b917d8d9b0
chore(influxdb): Placate the linter. 2020-08-27 15:46:32 -04:00
Stuart Carnie dee8977d2c
chore: move v2/v1/tsdb → v2/tsdb 2020-08-26 10:46:47 -07:00
Stuart Carnie 06fac044e5
fix(storage): Implement SeriesCardinality, which is per-bucket
Fixed unit tests
2020-08-25 14:52:00 -07:00
Stuart Carnie 9bebacf92f
fix(reads): Fix query cursor read that caused cursor truncation.
Port of #17610

Closes #19310
2020-08-25 09:01:47 -07:00
Stuart Carnie 047ed7836a
fix(Makefile): Remove redundant make targets
Fixes #19407
2020-08-21 13:24:03 -07:00
Stuart Carnie c01a62d5d4
chore(task): Remove unused code 2020-08-20 16:59:26 -07:00
Stuart Carnie 0a644dceed
fix(storage): BufferedPointsWriter is for a single org / bucket only
Fixes experimental.to tests
2020-08-03 15:15:00 -07:00
Stuart Carnie d7434216e2
fix(storage): Use correct engine paths
Remove redundant repl.go after rebasing on 8dd8d1f79e
2020-08-03 09:21:04 -07:00
Stuart Carnie 21c3733464
fix(storage): meta.Client persists to kv and updates via BucketService
Includes initial migration to add metadata bucket
2020-08-03 09:21:02 -07:00
Stuart Carnie 89532f0c29
refactor: move v2/v1/models to v2/models 2020-08-03 09:20:51 -07:00
Stuart Carnie a71b43ff17
refactor: remove redundant files
* retention will be enforced by the InfluxDB 1.x engine
* storage will be a shim for `tsdb`, so don't need tests here
2020-08-03 09:20:50 -07:00
Stuart Carnie d32709ed16
chore: More cleanup 2020-08-03 09:20:50 -07:00
Stuart Carnie 7c225cb3ac
chore: More cleanup 2020-08-03 09:20:50 -07:00
Stuart Carnie 26c18ac0a5
chore: Converging on 1.x tsdb 2020-08-03 09:20:48 -07:00
Edd Robinson 2b175291be
refactor: WIP removing tsbd 2020-08-03 09:18:34 -07:00
Stuart Carnie a97ec1f34e
feat: Initial commit with working reads 2020-08-03 09:18:34 -07:00
Edd Robinson 89efcb3d74
refactor: writes work 2020-08-03 09:18:34 -07:00
Stuart Carnie e3060c291c
refactor: tsdb store builds an runs 2020-08-03 09:18:32 -07:00
Edd Robinson 5f426195bf
refactor: start inserting tsdb store into engine 2020-08-03 09:17:24 -07:00
Edd Robinson 8c4bb1d65f
refactor: strip contents of storage engine 2020-08-03 09:17:24 -07:00
Yiqun (Ethan) Zhang baa8323431
fix: group resultset produces 1 table per group (#18968)
This helps resolve #18098
2020-07-29 15:31:29 -05:00
jlapacik 17391d6924
fix: call Next on read cursor at end of loop (#19012) 2020-07-23 15:06:17 -07:00
Jonathan A. Sternberg 8678a22ee3
feat(storage/flux): add tests for min/max pushdowns (#19028) 2020-07-23 16:07:30 -05:00
Ben Johnson 1247e7449d
Merge pull request #19018 from benbjohnson/tsi-series-file-limiter
feat(tsdb): Add optional mincore limiter to TSI & Series File
2020-07-23 12:34:23 -06:00
Christopher M. Wolff 8b106bcee1
feat(storage): add mean aggregate array cursor and tests (#19019) 2020-07-23 09:49:53 -07:00
Ben Johnson 3cc2638bbf feat(tsi1): Add optional mincore limiter to TSI 2020-07-22 10:17:42 -06:00
Jonathan A. Sternberg f854762cac
fix(storage/flux): do not wait for empty tables in the windower (#19008)
When splitting windows into their own individual tables, do not wait for
empty tables to be read. Empty tables may never be read so waiting for
them can result in a deadlock.

This was found while writing a test case for in progress work and so a
test case for this condition will follow in a future commit.
2020-07-21 17:38:33 -05:00
jlapacik b7e2330fa3 test: offset tests for min and max read cursors 2020-07-20 12:23:37 -07:00
jlapacik 36987bec0f feat: add offset parameter to window cursors 2020-07-20 12:23:37 -07:00
Christopher M. Wolff c695be2f56
feat(storage/reads): add min/max aggregate array cursors (#18957) 2020-07-20 10:17:04 -07:00
Ben Johnson c28eb70856 feat(mincore): Add page fault limiter
This commit adds `mincore.Limiter` which throttles page faults caused
by mmap() data. It works by periodically calling `mincore()` to determine
which pages are not resident in memory and using `rate.Limiter` to
throttle accessing using a token bucket algorithm.
2020-07-17 09:37:31 -06:00
Brett Buddin 51406f4f62
feat(tsdb): SHOW TAG KEYS (no time) query using only TSI data. (#18905)
* feat(tsdb): SHOW TAG KEYS (no time) query using only TSI data.

* fix(tsdb): Allow for earlier return when scanning during show tag keys.

* fix(tsdb): Speed things up by using the key merger to reduce allocs.

* chore(tsm1): Fix golint.

* fix(tsdb): Remove sorting, because these keys should already be sorted.

* fix(tsdb): Remove dead code to placate the linter.
2020-07-09 18:01:42 -04:00
Stuart Carnie d2dd19b70e
feat(storage): InfluxQL schema APIs without time range
These changes introduce optimized schema APIs for InfluxQL that
utilize the time series index (TSI) exclusively for significant
performance gains.
2020-07-09 10:09:19 -07:00
Ben Johnson 6b0b4d7c4e fix(storage): Refactor LoggingPointsWriter to use BucketFinder
This commit changes the writer to use `storage.BucketFinder` which
is a subset of the `influxdb.BucketService` interface.
2020-07-02 12:46:43 -06:00
jlapacik 3b50d08cd9 fix: window tables are empty if cursor is empty
Previously windowed aggregate tables would construct the _start and
_stop arrays before checking if the underlying array cursor was empty.
The table would therefore report itself as non-empty even though
there were no points within the table's time range. Now we check if
the underlying array cursor is empty before we construct any output
arrays. If the cursor is empty, meaning the series is empty, the
table will be dropped.

Fixes https://github.com/influxdata/influxdb/issues/18704.
2020-07-01 16:58:50 -07:00
Ben Johnson 482442ecc1 feat(storage): Add logging points writer
This commit adds a LoggingPointsWriter which wraps a PointsWriter
and provides logging when a write fails.
2020-07-01 11:41:29 -06:00
George 96d84b9126
refactor: migrator and introduce Store.(Create|Delete)Bucket (#18570)
* refactor: migrator and introduce Store.(Create|Delete)Bucket

feat: kvmigration internal utility to create / managing kv store migrations

fix: ensure migrations applied in all test cases

* chore: update kv and migration documentation
2020-07-01 12:08:20 +01:00
jlapacik c86ce5b325 feat(storage): read cursor for window last 2020-06-29 13:12:47 -07:00
jlapacik 81681fc7dc feat(storage): turn on capability for last selection 2020-06-29 13:12:47 -07:00
Brett Buddin 0c268e205b
fix(storage): Push-down a predicate to match tags for SHOW MEASUREMENT calls (#18740)
* fix(storage): Push-down a predicate to match tags for SHOW MEASUREMENTS calls.

* chore: Address feedback.

* fix(tsm1): Split behavior based on existence of predicate for show measurements.

* fix(tsm1): Allow parenthesis expression on the LHS of a predicate.

* fix(tsm1): Create a separate tag predicate verifier that rejects negative comparisons.

* fix(tsm1): Additional test cases for show measurements with predicate.
2020-06-29 14:31:54 -04:00
Jonathan A. Sternberg ec6e610cd5
fix(storage/flux): use the correct constant for CountKind in the reader (#18755) 2020-06-26 16:02:53 -05:00
Jonathan A. Sternberg 58bd5b9854
fix(storage/flux): the count aggregate will fill in zero values instead of null (#18735) 2020-06-26 15:43:03 -05:00
jlapacik f1c557ccd8 fix(storage): remove libflux dependency from storage
Storage should not have a dependency on libflux. This commit removes
some constants that were used from the flux universe package and
replaces them with local copies so that storage no longer has a
dependecy on the universe package.
2020-06-26 09:50:39 -07:00
jlapacik 5e4dd3f77a feat: flux table iterators for windowed selectors 2020-06-25 14:37:07 -07:00
jlapacik 0b52a48f83 test: table iterator tests for window first 2020-06-25 14:37:07 -07:00
jlapacik 3958c76604 feat: turn on storage capability for first 2020-06-25 14:37:07 -07:00
Ben Johnson 9784ebb781 feat(storage): Add option to disable WritePoints() validation.
This commit adds the `WithWritePointsValidationEnabled()` option
to disable validation in `Engine.WritePoints()` as the same
validation is performed earlier in the call stack by cloud.
2020-06-23 09:07:49 -06:00
Yiqun (Ethan) Zhang 95d97c6e29
feat(query): planner rule to push down window and bare first() and la… (#18534) 2020-06-17 14:00:40 -05:00
jlapacik 7f1caec697
feat: limit cursors (#18467)
* feat(storage): first array cursor

* feat: add first and last to rpc messages

* test(launcher): push down group first and group last

* feat(storage): window first array cursor

* test(launcher): push down bare first and bare last

* feat(storage): add capabilities for group first and group last

* refactor: rename first to limit

* refactor: make zero value for every period meaningful

* refactor: standardize launcher pushdown tests
2020-06-15 12:21:35 -07:00
Christopher M. Wolff 8fa5d3f591
feat(query): add test and feature flag for pushing down sum (#18484) 2020-06-12 13:28:03 -07:00
Christopher M. Wolff 796e5fbfb7
refactor(storage/reads): refactor/generalize aggregate array cursor code and add tests (#18414) 2020-06-11 16:01:47 -07:00
Jonathan A. Sternberg 1d5a7bf9c8
fix(storage/flux): fix the empty call for storage/flux (#18446)
The tables produced by `storage/flux` didn't previously pass our table
tests. The `Empty()` call is supposed to return false if the table was
ever not empty, but reading the table or calling `Done()` would cause
the table implementations here to return that they were always empty.
This messes up the csv encoder which then believes that it just emitted
an empty table.

The table tests for valid table implementations states that this is an
error for the table implementation. This change introduces a simple test
for `ReadFilter` and also runs the table tests on the filter iterator.
2020-06-11 09:32:27 -05:00
Jonathan A. Sternberg db686349e7
feat(storage/flux): support full aggregate window push down (#18399)
This enables a new rule that will push down the full `aggregateWindow`
query including the `duplicate` and `window(every: inf)` that recombines
the tables. When the full rule is used, the table is not split into
tables for each window and instead retains itself as a single table. The
start or stop column is renamed to `_time` and `_start` and `_stop` will
be the boundaries of the query.
2020-06-10 13:21:41 -05:00
Christopher M. Wolff cbaced1901
test(storage/reads): create a test helper for agg array cursor tests (#18398) 2020-06-08 14:04:41 -07:00
Christopher M. Wolff 3dbfffd851
refactor(storage/reads): refactor and add unit tests for *WindowCountArrayCursor (#18354) 2020-06-08 11:30:49 -07:00
jlapacik eba496d1bd
feat: grouped aggregate rewrite rules (#18342)
* feat: flags for pushing down new aggregates

* refactor: grouped aggregate rewrite rules

The storage operation ReadGroup aggregates per series on the storage
side. The planner will rewrite grouped aggregate queries to call
ReadGroup, which will perform a partial aggregation, followed by
another operation that will perform the rest of the aggregation on
the compute side.

* feat: storage capabilities for grouped aggregates

* fix: changes from review

* feat: group read operation name should include aggregate
2020-06-04 14:36:15 -07:00
Christopher M. Wolff 19a2496a28
fix(storage/reads): fix off-by-one error in WindowCountArrayCursor (#18343) 2020-06-02 16:04:22 -07:00
Jonathan A. Sternberg efbc4ae7c1
feat(storage/flux): implement create empty for the window table reader (#18288)
This implements create empty for the window table reader and allows this
table read function to be used when it is specified. It will pass down
the create empty flag from the original window call into the storage
read function.

This also fixes the window table reader so it properly creates
individual tables for each window. Previously, it was constructing one
table for an entire series instead of one table per window.

Tests have been added to verify three edge case behaviors. The first is
the normal read operation where all values are present. The second is
when create empty is specified so null values may be created. The third
is with truncated boundaries to ensure that storage is read from and the
start and stop timestamps get correctly truncated.
2020-06-01 17:57:50 -05:00
Paul Hummer 7c48976f94 test: add test for windowed count aggregate
This patch adds tests for `ReadWindowAggregate` and the one supported
window aggregate, the count aggregate.

Fixes #18183
2020-05-29 10:08:52 -06:00
Yiqun (Ethan) Zhang 7125db5e62
fix: remove unused imports (#18269) 2020-05-28 14:39:05 -05:00
Yiqun (Ethan) Zhang 41156ca646
feat(query): implement window count aggregate pushdown (#18043) 2020-05-28 13:42:38 -05:00
jlapacik 34e581ca0a Merge branch 'master' into chore/merge-master 2020-05-12 11:18:25 -07:00
Stuart Carnie bf1ad403f7
fix(reads): Fix ResultSetToLineProtocol to generate correct output
The ResultSetToLineProtocol test class was not generating correct
line protocol for string output (appending `i`)

In addition, the PR improves the mock.NewResultSetFromSeriesGenerator
type with options. The one option added is `WithGeneratorMaxValues`,
to limit the total number of values produced by the SeriesGenerator.
2020-05-08 12:39:54 -07:00
Jonathan A. Sternberg 7379e784ab
fix(storage/flux): fix a race condition in the tags cache (#17977)
The tags cache was not thread safe when called from multiple goroutines
at the same time. It was intended that it would be, but the locking was
done incorrectly and in too complicated a way. There was an assumption
that the LRU would only be updated from a single thread which wasn't
true at all.

The tags cache has now been updated to include some test cases that test
for race conditions and data validity. The tags cache itself has been
changed to follow a simpler algorithm.

1. Obtain a read lock.
2. Check if the cached array can be used.
3. Release the read lock.
4. If the above was unusable or did not exist, create an array for the
   tag.
5. Obtain a write lock.
6. Check if the cached array should be replaced and replace if needed.
7. Move the entry to the front of the LRU.
8. Release the write lock.

This simpler algorithm should ensure that this code is correct and that
creating the array is still done outside of the lock since creating the
array is the most expensive operation of the ones above.
2020-05-07 15:01:48 -05:00
jlapacik 7cb599c582 feat(storage): convert ResultSet to table stream for aggregate window 2020-05-05 10:50:15 -07:00
Yiqun Zhang e341a51ff0 fix: fmt 2020-05-05 01:43:22 -05:00
Yiqun (Ethan) Zhang 8bb5065769 refactor: unify WindowAggregateCapability (#17901) 2020-05-05 01:35:02 -05:00
jlapacik 6d885c7112 Merge branch 'master' into chore/update-flux 2020-04-29 10:02:19 -07:00
Yiqun (Ethan) Zhang 3c2ab1b681
feat(query): Reader implementation for WindowAggregate (#17885) 2020-04-29 10:42:16 -05:00
jlapacik 457637ed22 Merge branch 'master' into chore/merge-master 2020-04-28 13:13:36 -07:00
Yiqun (Ethan) Zhang a7e3679aaf
refactor: rename the store-side WindowAggregateReader interface to WindowAggregateStore (#17880) 2020-04-28 13:44:46 -05:00
Ben Johnson 3e87ef52b6 feat(storage): Add compaction enablement API to Engine. 2020-04-28 08:23:34 -06:00
Yiqun (Ethan) Zhang e29eeabcec
feat: complete ReadWindowAggregateRequest (#17871) 2020-04-27 10:51:43 -05:00
jlapacik 3f4368ddd9 chore: update flux to latest algo-w revision 2020-04-24 14:40:37 -07:00
jlapacik 3079d2a8aa Merge branch 'master' into chore/merge-master-into-algo-w 2020-04-24 14:21:26 -07:00
Jonathan A. Sternberg 69bdae7f7d
refactor(storage/reads): refactor the capabilities interface (#17850)
The capabilities interface will now return a mapping of capabilities to
a capabilities object. The capabilities object will contain a list of
features supported by the capability.
2020-04-23 16:16:52 -05:00
jlapacik d60b877df3 Merge branch 'master' into chore/merge-master-into-algo-w 2020-04-23 11:35:57 -07:00
Jonathan A. Sternberg d764ca3798
refactor(query): return detailed capabilities for the read window aggregate interfaces (#17836)
This modifies the read window aggregate interfaces to future-proof it
if and when we add additional capabilities to the method. Previously,
the interface was all or nothing. If we modified the RPC call itself, we
would have to make a new interface to denote the change to the Go code.

This changes the interface so now a `WindowAggregateCapability` exists.
This way, we can modify the struct to include things like:

```
type WindowAggregateCapability struct {
    WindowPeriodCapability bool
    MeanAggregateCapability bool
}
```

This way we can learn if the RPC call itself supports some specific
option. If the first iteration doesn't support a mean aggregate or the
mean aggregate is only supported by single server implementations, the
window aggregate can tell the caller that it won't be able to compute
the mean aggregate.

Since it fills in a struct with these capabilities, the struct can
safely introduce new values. If a downstream consumer wants to take
advantage of that functionality, then all interfaces in the chain have
to be updated to consume the upstream capabilities.
2020-04-23 10:22:33 -05:00
jlapacik 63fd3655be Merge branch 'master' into chore/merge-master-into-algo-w 2020-04-22 14:52:59 -07:00
Jonathan A. Sternberg 60c58ad805
feat(query): add interface for the window aggregate capability (#17801)
Added an interface for an additional storage capability. This interface
will allow for checking if the reader supports the window aggregate call
and another method for invoking the call if it does.

This is implemented using a single interface. If the reader implements
the interface, it indicates that the client is capable of reading the
response. The `HasXXX` method is intended to check if the store supports
the operation. This method also takes a context because it could require
a remote call or to wait for one.
2020-04-21 14:15:38 -05:00
jlapacik 335968a552 Merge branch 'master' into chore/merge-master 2020-04-20 13:59:21 -07:00
Stuart Carnie c76f30682c
fix(storage): Feedback in response to PR review
* Adds clarifying documentation
* Regenerate protocol buffers with updated documentation
2020-04-16 15:19:28 -07:00
Stuart Carnie 6325591deb
feat(storage): New data types for measurement schema gRPC APIs
This commit

* adds new request and response data types for schema gRPC calls
* adds fmt.Stringer implementation to cursors.FieldType
* adds APIs to sort a slice of MeasurementField values,
* upgrades the gogo protobuf package to v1.3.1, which
  includes improvements to serialization.
2020-04-16 14:51:31 -07:00
Stuart Carnie 0d998c269a
chore(storage): Fix code documentation comments 2020-04-16 14:51:31 -07:00
jlapacik 7541af8414 chore: merge master into algow 2020-04-15 14:42:03 -07:00
Stuart Carnie 21e339a32f
chore(storage): Fix documentation to reflect correct time interval 2020-04-14 11:04:56 -07:00
Stuart Carnie fe0ed6cb7e
feat(storage): Provide public MeasurementFields API 2020-04-14 10:49:16 -07:00
Stuart Carnie a3dec4b120
Merge pull request #17728 from influxdata/sgc/issue/6550
chore(storage): Remove redundant gRPC service from protobuf definition
2020-04-14 10:46:23 -07:00
Stuart Carnie abb6821f89
chore(storage): Remove redundant gRPC service from protobuf definition 2020-04-13 16:27:58 -07:00
kun 80e71d6ee0 fix(storageflux): fix data race on tags map (#17702) 2020-04-11 18:40:50 +08:00
jlapacik 5fe5da4ec7
fix(flux): return internal influxdb error for cursor conflict (#17697)
* fix(flux): return internal influxdb error for cursor conflict

Closes https://github.com/influxdata/influxdb/issues/17680.

* refactor: update error code from EInternal to EInvalid
2020-04-09 14:40:41 -07:00
Jonathan A. Sternberg 1bb08ceaf8
refactor(query/stdlib): modify storage filters to use the predicate directly (#17650)
The storage filters are modified to use the predicates directly so we do
not have to pass `semantic.FunctionExpression` around. Instead, since
simple expressions are all that are supported anyway, we transform
suitable function expressions into predicates as part of the push down
rule and this simplifies the influxdb reader code.

This also moves the storage predicate conversion code into the standard
library package as it is the only location that uses this code now that
the predicate conversion is done as part of the push down rule.

This refactor was prompted by another refactor of the
`semantic.FunctionExpression` that would cause it to always contain a
`semantic.Block`. Since the push down filter needs the expressions and
to combine them, this refactor allows us not do construct a combined
filter inside of blocks which allows us to have better type safety.
2020-04-07 10:45:08 -05:00
Faith Chikwekwe edc1a7413d fix(storage/reads): update sortKey sorting method to use null byte as delimeter 2020-04-06 14:52:19 -07:00
Ben Johnson e639f99d03 fix(storage): Add filter regression test 2020-04-06 14:19:16 -06:00
Ben Johnson abfe5a54a0 fix(storage): Fix query cursor read that caused cursor truncation.
Filter cursors buffer points in between calls to Next() if the number
of read points exceeds 1000. Previously, this buffer was being cleared
out before being iterated over which caused queries to return a resultset
which had a number of rows divisable by 1000.

This change moves the clearing of the buffer until after the points have
been read. This change affects any queries which read more than 1000 points
from a single series & have a filter that can be successfully applied to at
least one of those points.
2020-04-06 13:54:16 -06:00