Commit Graph

313 Commits (e8fe3c9ed603a33b196068f273c4bb0fd38a6d5f)

Author SHA1 Message Date
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
Jonathan A. Sternberg d3fa60991f
Merge branch 'master' into chore/merge-master 2020-04-06 12:17:47 -05:00
Jonathan A. Sternberg 6e4cf7ffef
refactor: fix imports from go template files (#17615) 2020-04-03 17:40:36 -05:00
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
Jonathan A. Sternberg 469c5849c4
Merge branch 'master' into feat/use-algo-w 2020-04-03 09:30:04 -05:00
Stuart Carnie d424d7d1f5
feat(tsdb): Add new measurement based schema APIs
These APIs require a measurement, permitting an additional optimization
to reduce the search space against the TSM index. Specifically, the
search key prefix is extended from `org+bucket` to
`org+bucket,\x00=<measurement>`

* MeasurementNames
* MeasurementTagKeys
* MeasurementTagValues
* Adds an api to the models package for efficiently parsing the
  measurement tag (\x00) from a normalized series key
2020-04-02 08:33:58 -07:00
Yiqun (Ethan) Zhang 48efdb52ea
build(flux): update Flux to v0.65.0 (#17484) 2020-03-27 18:42:19 -04:00
Jacob Marble 386098da36
refactor(storage): move and remove to help cleanup tsdb package (#17275)
* refactor(tsdb): move series file config to seriesfile package

* refactor(tsdb): removed unchecked const EOF

* refactor(tsdb): unexport errors

* refactor(tsdb): remove unused TagValueIterators

* refactor(tsdb): remove SeriesIDIterator usage in tsdb/seriesfile

* refactor(tsdb): remove one-use MeasurementIterators

* refactor(tsdb): remove unused type measurementSliceIterator

* refactor(tsdb): remove unused types TagKeyIterators and tagKeySliceIterator

* refactor(storage): remove unused method Engine.ApplyFnToSeriesIDSet

* refactor(tsdb): rename AllSeriesIDs() -> SeriesIDs()
2020-03-16 12:23:15 -07:00