Commit Graph

432 Commits (master)

Author SHA1 Message Date
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
Jacob Marble 7dbc07beda
chore: Revert "refactor(storage): move and remove to help cleanup tsdb package (#17241)" (#17272)
This reverts commit 4b8a71b97f.

Fixes incident #inc-aws-error-rate-spi-5e6c1423
2020-03-13 17:14:51 -07:00
Jacob Marble 4b8a71b97f
refactor(storage): move and remove to help cleanup tsdb package (#17241)
* 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): remove read from unexported field
2020-03-13 13:04:58 -07:00
Jacob Marble 26ca766459
refactor(tsdb): move series file to its own package (#17224)
* refactor(storage): move type ByTagKey to the only package that uses it

* refactor(tsdb): use types in tsdb/cursors

* refactor(tsdb): remove unused type SeriesIDElems

* refactor(tsdb): inline only use of tsdb.ReadAllSeriesIDIterator

* refactor(tsdb): move series file to its own package

* refactor(storage): remove platform->influxdb aliases
2020-03-12 11:32:52 -07:00
Jacob Marble cdbf532f57
refactor(storage): remove dead code and rename a few things (#17217)
* refactor(storage): remove CursorIterators type

* refactor(storage): remove unused tsdb.MarshalTags()

* refactor(storage): remove unused package tsdb/internal

* refactor(storage): rename tsdb/metrics.go to tsdb/series_file_metrics.go

* refactor(storage): remove unused type tagValueSliceIterator

* refactor(storage): rename field row to seriesRow

* refactor(storage): rename tsdb/index.go to tsdb/series_iterators.go
2020-03-12 10:45:48 -07:00
Sebastian Borza eeece73675
chore(storageflux): update failing tests 2020-03-10 17:54:07 -05:00
Sebastian Borza a50e69451e
feat(storageflux): move flux components out to separate package 2020-03-10 17:54:04 -05:00
Jonathan A. Sternberg 7012470479
Merge branch 'master' into feat/use-algo-w 2020-03-10 14:52:28 -05:00
Jacob Marble 9e8da7c313
refactor(storage): cleanup in storage/reads (#17163)
* refactor(storage): remove cursorContext.limit and .count

* refactor(storage): remove one-impl interface

* refactor(storage): remove one-line multiShardArrayCursors.newAggregateCursor()

* refactor(storage): mostly rename fields and variables

* refactor(storage): multiShardArrayCursors has one shard

* refactor(storage): drop misleading 'multiShard' from names
2020-03-10 07:50:47 -07:00
Jonathan A. Sternberg 4d683859e9
Merge branch 'master' into feat/use-algo-w 2020-03-09 13:31:46 -05:00
Jonathan A. Sternberg 400d710bc0
refactor(storage/reads): remove the storage dependency on libflux (#17109)
This removes the storage dependency on libflux by moving the interfaces
it implements to the `query` package so it can reference the definitions
rather than the package with the implementation and the registration
with the runtime. This breaks the dependency where a storage package
depends on a flux runtime package.
2020-03-06 19:59:16 -06:00
Jacob Marble 8bfe05e554
refactor(storage): remove reads.ResponseWriter (#17137)
ResponseWriter is only used in IDPE, so move it to that repo.
2020-03-06 15:54:11 -08:00
Jacob Marble 39b7c2ab76
refactor(storage): export IndexSeriesCursor (#17134)
* refactor(storage): add readSource field accessors

* refactor(storage): remove unused limitSeriesCursor

* refactor(storage): export IndexSeriesCursor

This allows IDPE to use the same implementation, rather than duplicate
code. Also copied unit tests from IDPE.

* chore: go fmt
2020-03-06 14:05:03 -08:00
Jacob Marble 5efde876d7
refactor(storage): rename things so flux and influxql influence is clear (#17108)
* refactor(storage): rename things so flux and influxql influence is clear

* chore: go fmt
2020-03-05 15:23:05 -08:00
Jacob Marble 1facad82dd
refactor(storage): move unused code to repo that needs it (#17090)
* refactor(storage): move unused code to repo that needs it

Turns out that a bunch of code is only needed in IDPE. This change
removes that code, and another PR adds it to IDPE.

* refactor(storage): export KeyMerger

* refactor(storage): export NilSortHi and NilSortLo

* refactor(storage): move StringIterator & friends to IDPE

* refactor(storage): unexport a few test helper funcs
2020-03-05 14:15:51 -08:00
Jacob Marble 83818e9592
fix(storage): incremental improvments (#17011)
* fix(storage): simplify storage/seriesCursor

storage/seriesCursor releases series file and TSI references sooner.

Remove unhelpful request object, inherited from 1.x

* chore(storage): replace SeriesCursor interface with sole implementation
2020-02-28 11:12:43 -08:00
Jacob Marble 9f71cad966 fix(storage): small improvements to readservice/store
Use tracing properly, simplify a few lines.
2020-02-24 13:31:36 -08:00
Stuart Carnie f1990cc92c
feat(mock): Add SeriesGenerator to ResultSet transformation
In addition, adds a ResultSetToLineProtocol function, which
transforms a `ResultSet` into InfluxDB line protocol.
2020-02-12 14:20:31 -07:00
Jacob Marble a56e0226e6
fix(storage): check engine closed before collecting index metrics (#16656) 2020-01-23 15:27:25 -08:00
Jacob Marble b836ab9c17
feat(storage): implement backup and restore (#16504)
* feat(backup): `influx backup` creates data backup

* feat(backup): initial restore work

* feat(restore): initial restore impl

Adds a restore tool which does offline restore of data and metadata.

* fix(restore): pr cleanup

* fix(restore): fix data dir creation

* fix(restore): pr cleanup

* chore: amend CHANGELOG

* fix: restore to empty dir fails differently

* feat(backup): backup and restore credentials

Saves the credentials file to backups and restores it from backups.

Additionally adds some logging for errors when fetching backup files.

* fix(restore): add missed commit

* fix(restore): pr cleanup

* fix(restore): fix default credentials restore path

* fix(backup): actually copy the credentials file for the backup

* fix: dirs get 0777, files get 0666

* fix: small review feedback

Co-authored-by: tmgordeeva <tanya@influxdata.com>
2020-01-21 14:22:45 -08:00
Edd Robinson de36a868f7 refactor: add engine write benchmarks 2020-01-16 21:01:57 +00:00
Edd Robinson 5a179b1f95
Merge pull request #16265 from influxdata/er-dump-wal-pred
feat: add predicate output to WAL dump tool
2020-01-02 11:46:57 +00:00
Johnny Steenbergen e6f1805e5e chore(inmem): nuke the duplicative inmem store
use kv store... its a thing
2019-12-30 11:04:45 -08:00
David McKay 8db09124e6 fix: update test to use 'valid' marshalled predicate 2019-12-18 15:33:44 +00:00
Edd Robinson e24b66d78a feat: add predicate output to WAL dump tool 2019-12-18 12:05:26 +00:00
Greg 41e771a464
feat(http): expose list of available telegraf plugins (#16233) 2019-12-17 16:53:19 -07:00
Jonathan A. Sternberg fe94c5cae4
feat(storage/reads): add cache to reuse tags when reading from storage (#16041)
This adds an lru cache for the columns that are produced as tags. When
producing the columns that are part of the group key, it will generate
the column and then keep it in an lru cache to reuse for future tables.
The start and stop column are effectively cached for every table because
they are special and will be the same for all of the tables.

For the tags, it retains the most recently used since they may be used
by a future table. That way most of the columns will get shared with
each other.

When the size differs, a slice is used so the underlying data is still
shared, but the size is different.
2019-11-27 08:31:53 -06:00
Jonathan A. Sternberg 2b4e6283ce
perf(storage/reads): remove the duplicate filter (#16024)
This removes the duplicate filter that is used by the reader. The
storage engine shouldn't be sending us duplicate tables anyway and this
code hurts performance in high cardinality queries because of the memory
it uses to keep track of all of the keys that have been seen.
2019-11-22 12:38:16 -06:00
Edd Robinson 0999f88273 fix: prevent integer overflow 2019-11-22 14:06:21 +00:00
Chris Goller 0f5df301ca refactor(storage/readservice): rename View interface to Viewer 2019-11-20 16:10:37 -06:00
Chris Goller 7de2cafb13 feat(storage/readservice): define engine interface
We added an interface for the *storage.Engine to make it easier
to add end-to-end tests.

Co-authored-by: Bucky Schwarz <d.w.schwarz@gmail.com>
2019-11-20 15:54:32 -06:00
Edd Robinson 8f6701d4b1 feat(storage): add full compaction semaphore
By default this feature is disabled; the full compaction behaviour does
not change. When this feature is enabled compactions can be limited
across multiple storage engines running in multiple processes.

The mechanism by which this happens is not part of the abstraction added
here.
2019-10-23 19:45:01 +01:00
Brandon Farmer ea82dc3470 fix(tasks): tasks look up system bucket id 2019-10-21 14:48:47 -07:00
Brandon Farmer 2e0749b3ba feat(influxdb): Add system buckets on org creation
* Only allow users to create user buckets
* Only accept bucket creation parameters on post
2019-10-21 14:48:47 -07:00
Kelvin Wang 62f4042853 feat(influxdb): add predicate package 2019-10-18 12:02:52 -04:00
Edd Robinson 179c57ab2e feat(storage): allow compaction limiter to be injected 2019-10-04 12:35:21 -07:00
elbehery c0b87c657c fix(storage): remove level=0 from TSM disk bytes metrics. 2019-09-25 15:57:25 +02:00
Brandon Farmer d83fabeabc feat(influxdb): user disabling 2019-09-23 11:57:16 -07:00
Edd Robinson db72f57da4 feat(storage): inject function to control when retention enforcer runs (#15136)
* test(storage): ensure multiple engines can run concurrently

* feat(storage): expose control over retention run

Fixes #15134.

This commit adds the ability to inject a functional option into a
storage.Engine for controlling when the retention enforcer can run.

Previously, retention enforcers ran on an interval; if you ran multiple
storage engines (as we do in some environments) then it was not possible
to coordinate when engines ran retention. Often they would synchronise
because they started at the same time.

This change will let you specify a blocking function to control when the
retention enforcer can run.

A simple function for serialising retention enforcement across multiple
storage engines could look like:

```go
var mu sync.Mutex
func f() (done func()) {
    mu.Lock()
    return func() { mu.Unlock() }
}
```
2019-09-23 08:09:04 -07:00
Lorenzo Affetti 053836e5a5
Merge pull request #15203 from influxdata/flux-staging-v0.48.x
build(flux): update to Flux v0.48.0
2019-09-20 18:24:02 +02:00
Lorenzo Affetti ab835c8e0e
refactor(dependencies): use new dependency injection framework (#15174)
refactor(dependencies): use new dependency injection framework
2019-09-19 17:01:17 +02:00
Edd Robinson e2f5b2bd9d refactor(storage): add more context to traces and logs 2019-09-19 13:48:06 +01:00
Ben Johnson 9237ee6a40
fix(tsi1): Remove TSI cardinality stats cache 2019-09-04 14:48:22 -06:00
George 8109d161bb
perf(storage): expose ability to peek on stream readers (#14901) 2019-09-04 13:57:36 +00:00
Nathaniel Cook dfc28335ea refactor(query/dependencies): update to new Flux dependencies defaults 2019-08-26 16:46:17 -06:00
Adam 945b68b8fd fix(query): finish refactoring the repl and inject the secret service as a dependency 2019-08-26 16:46:17 -06:00
Nathaniel Cook 6303e2dcc5 test(query): skip holt_winters_panic test
added executor dependencies where needed
2019-08-26 16:46:17 -06:00
Adam Perlin 76dbc44e3c
feat(storage): Add influxd inspect dumpwal tool (#14237)
* feat(storage/wal/dump): initial influxd inspect dumptsmwal implementation

* feat(storage/wal/dump): add org bucket formatting to dumpwal tool; improve test cases

* refactor(storage/wal/dump): add long description for dumpstmwal tool

* refactor(storage/wal/dump): rename dumptsmwal flag

* chore(storage/wal/dump): gofmt

* refactor(storage/wal/dump): update error printing in dumptsmwal tool

* refactor(storage/wal/dump): address review comments

* refactor(storage/wal/dump): rename dumpwal command source file

* refactor(storage/wal/dump): clarify print flag comment

* refactor(inspect): remote unnecessary for-loop in influxd inspect command
2019-08-23 13:05:06 -07:00
Jacob Marble 851279b71f
chore(storage): bring back storage_retention_checks_total (#14735) 2019-08-22 10:47:27 -07:00
Edd Robinson d160585a34 refactor(storage): add deeper tracing around deletes 2019-08-22 11:08:33 +01:00
Jacob Marble 26d29f7aa5
chore(storage): remove metric storage_retention_checks_total (#14719) 2019-08-20 14:39:08 -07:00
Stuart Carnie f60c2ec3ba
fix(reads): Remove issue reference from test per feedbakc 2019-08-16 13:00:06 -07:00
Stuart Carnie 3ca751cfd6
fix(reads): ResponseWriter truncates values for last series
The ResponseWriter would truncate the last series if the byte size of
the points frames exceeded the writeSize constant, causing a Flush to
occur and the cumulative ResponseWriter.sz to reset to zero. Because
ResponseWriter.sz was not incremented for each frame, it remained at
zero, which resulted in the final Flush short circuiting.

This commit implements the Size method for the cursors.Array types
to be used to estimate the size of frame. This is in place of calling
the Protocol Buffer `Size` function, which can be very expensive.
2019-08-16 10:36:40 -07:00
Stuart Carnie 0b20c227b4
feat(reads): A series of helpers to produce a SeriesCursor
This allows the data/gen package to be used to produce a SeriesCursor
for generated data that can be used in testing by the reads package.
2019-08-16 10:36:30 -07:00
Jonathan A. Sternberg 3d747b4fb1
fix(storage/reads): remove duplicate tables from the stream (#14601)
If the reader produces more than one table with the same group key, we
discard the later ones because the stream should never give us more than
one table with the same group key.

This is an error and it indicates the server sent us a bad set of data.
This change makes it so that the client is tolerant of that data and
will discard it if it exists.
2019-08-15 10:20:35 -05:00
Edd Robinson 5aead27e8b refactor(storage): remove commented code 2019-08-12 13:49:26 +01:00
j. Emrys Landivar (docmerlin) 7bd481d829 respond to pr comments 2019-08-05 13:16:51 -05:00
j. Emrys Landivar (docmerlin) 24c1f21e4e WIP 2019-08-05 13:16:51 -05:00
Christopher M. Wolff 42bb664aaf
feat(query): add storage request duration metric (#14534)
influxdata/idpe#4126
2019-08-02 08:53:14 -07:00
tmgordeeva 48ee7ada04
fix(storage): move retention snapshot out of per bucket calls (#14420)
* fix(storage): move retention snapshot out of per bucket calls

Also adds tracking for snapshots from retention and full compactions.
2019-07-23 11:40:05 -07:00
tmgordeeva 871f5466fe
fix(storage): run snapshot before retention deletes (#14400)
Deleting from the cache takes a lock which blocks writes. Snapshot to clear the
cache before deleting to reduce the lock contention.
2019-07-22 16:22:42 -07:00
Edd Robinson abbe795fa5 docs(storage): update PB doc to reflect new domain 2019-07-05 17:10:56 +01:00
Jonathan A. Sternberg 8cf3453d5c
fix(storage/reads): storage table implementation passes table tests (#14234) 2019-07-03 09:26:08 -05:00
Adam Perlin 24baec9e6d Gofmt verify-wal files 2019-06-27 16:28:28 -07:00
Adam Perlin fba4326c72 feat(storage): remove unnecessary lines from verify-wal test 2019-06-27 16:28:28 -07:00
Adam Perlin f4faa9b2f5 feat(storage): Small verify-wal output and test tweaks 2019-06-27 16:28:28 -07:00
Adam Perlin c868ece4f6 feat(storage): Initial 2.x verify-wal tool functionality 2019-06-27 16:28:28 -07:00
Tanya Gordeeva 6428cdbce6 fix(storage): initialize tsm file metrics, update after compaction
These metrics weren't being properly intialized on opening the file store, and
weren't being properly updated on compaction.
2019-06-20 14:37:53 -07:00
Ben Johnson 14980d55b8
fix(storage): Add WithCurrentGenerationFunc() for generation injection.
Adds the ability to set the current generation to use when compacting
the cache only. Previously, we used the current generation for all
files but this causes issues and we should only use the current
generation for level 1 compaction.
2019-06-20 08:54:38 -06:00
Jonathan A. Sternberg eeb32beb49
fix(storage/reads): ensure that the column reader gets its length set (#14065)
When a buffered column reader was used, the length was not reset to
whatever the requested length was for the buffer so it was possible for
the length to be longer than the actual columns.
2019-06-05 15:09:37 -05:00
Jonathan A. Sternberg 2b1c1ec143
fix(storage/reads): fix the storage tables to work correctly with multiple transformations (#14016)
The storage table reader will now work correctly when there are multiple
outputs. The table interface now implements the new table and column
reader interfaces and works properly with `execute.CopyTable`. The
source uses `execute.CopyTable` to buffer the table in memory when there
are multiple output transformations.
2019-05-30 12:31:54 -05:00
Mark Rushakoff 4b3d57c06d fix(storage): add missing RUnlock in Engine.Close
I don't see anywhere obvious that an engine would be closed twice, but
if it was, the RLock would have been held permanently, such that a Lock
could not be taken later.

Running go test ./storage/... did not trigger a double-close.
2019-05-29 08:40:40 -07:00
Jonathan A. Sternberg 21c80f3e93
refactor(query/control): move the controller from flux to influxdb (#13991)
The controller implementation is primarily used by influxdb so it
shouldn't be part of the flux repository. This copies the code from flux
to influxdb so it can be removed from the next flux release.
2019-05-29 09:04:34 -05:00
Jonathan A. Sternberg ebdbc394fc
chore(flux): update to Flux v0.31.0 (#14002)
* refactor(storage/reads): update the table implementation for the interface change (#13994)

* chore(flux): update to Flux v0.31.0
2019-05-28 17:24:26 -05:00
Jonathan A. Sternberg c98a40db14
fix(storage/reads): stop copying the values to an unnecessary buffer in the storage reader (#13933)
The copy was unnecessary since it was just going to be copied
immediately afterwards into an Arrow buffer. In the future, we will want
to have storage directly send the arrow buffer, but right now we are
putting it in an array and copying it anyway.

Even when we send an arrow buffer, the underlying sequence of bytes is
probably going to be different and we will rely on the allocator to
reuse bytes so let's remove the extra copy.
2019-05-15 20:40:29 -05:00
Christopher Wolff 90a5d88fc5 fix(query): skip failing end to end tests 2019-05-14 12:52:37 -07:00
jlapacik faab75968b refactor(storage): remove Read method from Store interface 2019-05-03 11:02:20 -07:00
Jeff Wendling ef0768db31
tsm1: predicate deletes (#13371)
tsm1: predicate deletes
2019-05-03 14:27:25 +00:00
Lorenzo Affetti 26d327ef9d
Merge pull request #13752 from influxdata/fix/read-filter
fix(readservice): normalize special tag keys after reducing request p…
2019-05-02 20:13:32 +02:00
Stuart Carnie bf774b66ce
fix(storage): Ensure Tag(Keys|Values) APIs never return (nil, nil)
Formalized this post condition in the documentation and added additional
unit tests.

Added a nil guard and unit test to WriteStringIterator.
2019-05-02 09:45:38 -07:00
Lorenzo Affetti 0993a9f15b fix(readservice): normalize special tag keys after reducing request predicate 2019-05-02 16:55:08 +02:00
Stuart Carnie d858bd6f77
fix(storage): Sort keys were incorrectly sorted when concatenated
This manifested as incorrect sort ordering when serialized via RPC,
resulting in an `invalid partition key order` error.

This fix introduces a delimiter to ensure sort keys cannot collide.
2019-05-01 13:37:28 -07:00
Jeff Wendling 16e9eb4cb9 tsdb: respond to feedback and improve test coverage
predicate.go:
	UnmarshalPredicate       100.0%
	NewProtobufPredicate     100.0%
	Matches                  100.0%
	Marshal                  100.0%
	walkPredicateNodes       100.0%
	buildPredicateNode       100.0%
	newPredicateState        100.0%
	Reset                    100.0%
	Set                      100.0%
	newPredicateCache        100.0%
	Cached                   100.0%
	Store                    100.0%
	Update                   100.0%
	Update                   92.9%
	Update                   94.1%
	predicateEval            90.9%
	predicatePopTag          100.0%
	predicatePopTagEscape    100.0%
2019-05-01 13:40:40 -06:00
Jeff Wendling 4b4a814d7d storage: fix predicate matching on field tags 2019-05-01 13:40:40 -06:00
Jeff Wendling e84d4625a5 storage: add predicate deletes to the engine interface 2019-05-01 13:40:40 -06:00
Jeff Wendling e10939b8af storage: add predicate tracking to the WAL 2019-05-01 13:40:40 -06:00
Jeff Wendling 7403fd8aa9 tsm1: rename engine method to DeletePrefixRange
The storage/engine knows about buckets, but the tsm1/engine doesn't, so
name the tsm1/engine method Prefix and keep the storage/engine named
Bucket.
2019-05-01 13:40:40 -06:00
jlapacik 5d90683b07 refactor(storage): remove no points tables and streamReader interface
These tables were previously used to perform meta queries.
Meta queries are now answered using a specific API, and as
a result, these tables can go away.
2019-05-01 10:35:10 -07:00
jlapacik 95aa194498 feat(storage): ReadGroup RPC definitions and storage reader 2019-05-01 10:35:10 -07:00
Stuart Carnie f56b4ef020
Merge pull request #13723 from influxdata/sgc/fix/merge
Ensure GroupCursor Keys is union of keys from all GroupCursors of current partition key
2019-05-01 09:07:53 -07:00
Jacob Marble 8c269e0153
chore(log): Put trace_id back in logs (#13712)
* chore(log): Put trace_id back in logs

* fix tests
2019-04-30 18:51:22 -07:00
Stuart Carnie 96c2282aab
fix(query): Keys must be union of all keys from all GroupCursors 2019-04-30 15:49:36 -07:00
Jonathan A. Sternberg e181edd077
fix(storage/reads): translate measurement and field tag key names (#13707)
Translate the measurement and field tag key names to their non-storage
names and add the `_start` and `_stop` tag keys to the output since
they aren't real tags, but ones that are added by range.
2019-04-29 18:11:20 -05:00
Jonathan A. Sternberg 96a76aad1d
fix(storage/reads): reserve data for the tags column when building a table (#13691) 2019-04-29 14:28:25 -05:00
Kelvin Wang ea54e2c2c8 fix(kv): fix empty org name 2019-04-26 18:16:28 -04:00
Stuart Carnie fb39ac39ce
fix(storage): Store.Read behavior changed to return unsorted series keys
Closes #13581
2019-04-26 10:38:59 -07:00
Jonathan A. Sternberg 46d2d0012b fix(storage): translate _measurement and _field to the proper strings (#13662)
The RPC call should translate `_measurement` and `_field` to their
proper shortened byte strings when requesting the tag values.

This also fixes the planner rewrites to return the root node even when
no rewrite happened as this is required by the planner.
2019-04-26 10:36:51 -07:00
Stuart Carnie ed344d25f8
feat(storage): Teach storage how to find a distinct set of tag keys
The TagValues API will perform a linear scan if there is no predicate;
otherwise, it will use the index to find a list of candidate series
keys.

TagKeys expects the predicate to be transformed such that
`_measurement` and `_field` are remapped to `\x00` and `\xff`
respectively.

There is one TODO marked to analyze the predicate for a
`\x00 = '<measurement>'` pattern. If found, the predicate can be
eliminated and fall back to a linear prefix scan by combining the org,
bucket and measurement. This is tracked by issue #13497.
2019-04-24 11:14:22 -07:00
Ben Johnson 01bfcf822b
Merge point parse & explode (#12377)
Merge point parse & explode
2019-04-24 10:30:16 -06:00
Ben Johnson 272f340c30
Merge point parse & explode. 2019-04-24 10:12:15 -06:00
Jonathan A. Sternberg 5e77bd1e28
feat(query): implement the read tag values rpc call in the query engine (#13559)
If a pattern is seen that matches the `v1.tagValues(...)` call, then it
will be replaced with a direct RPC call to read the tag values for the
selected tag key which should be better optimized than reading from the
storage engine tsm1 files.
2019-04-23 12:56:35 -05:00
kelwang 0916741838
Merge pull request #13286 from influxdata/bucket_scrapper_org_rename
Bucket scrapper org rename
2019-04-22 19:46:51 -04:00
Jacob Marble bc2650813d
chore(storage): Merge StringIterator cursor stats (#13558)
* chore(storage): Merge StringIterator cursor stats

* add unit test

* properly count stats after iteration
2019-04-22 15:39:21 -07:00
Kelvin Wang 7a72c363f2 remove org from bucket 2019-04-22 18:39:05 -04:00
Jonathan A. Sternberg e5657ca62b
feat(query): implement the read tag keys rpc call in the query engine (#13513)
If a pattern is seen that matches reading the tag keys, it will be
replaced with a direct RPC call to read the tag keys which should be
better optimized than reading from the storage engine tsm1 files.
2019-04-22 14:09:44 -05:00
Jacob Marble 662cf578c9
fix(storage): Assume sorted StringIterators, and retain sorted order (#13491)
* fix(storage): Assume sorted StringIterators, and retain sorted order

* embed struct field

* improve MergedStringIterator efficiency
2019-04-19 01:22:49 -07:00
Stuart Carnie 7a3b097197
fix: Add API compatibility assertion 2019-04-18 16:19:19 -07:00
Stuart Carnie 972cda1775
feedback: Changes in response to PR feedback 2019-04-18 16:19:18 -07:00
Stuart Carnie 7fc9661b7b
chore: Move StringIterator to cursors package for wider reuse 2019-04-18 16:19:17 -07:00
Todd Persen cd64ec8718 Fix typos in miscellaneous packages 2019-04-17 13:30:22 -07:00
Jacob Marble ff82e844ae
feat(storage): Add StringIteratorWriter.WrittenN() (#13456) 2019-04-17 11:05:45 -07:00
Jacob Marble 53810fadeb
feat(storage): Implement storage schema RPC de/serializer, merge, APIs (#13409)
* Extend storage service protobuf with TagKeys and TagValues

Co-authored-by: Michael Desa <mjdesa@gmail.com>
Co-authored-by: Jacob Marble <jacobmarble@influxdata.com>

* Extend the reads.Store interface with new TagKeys and TagValues APIs

* Extend readservice.store to implement refactored reads.Store interface

* Implement a StringIterator gRPC writer / serializer

* Implement a StringIterator gRPC reader / deserializer

* Implement a StringIterator merger
2019-04-16 16:01:05 -07:00
Stuart Carnie 5a224c74ea
feat(storage): Stub storage schema APIs
Closes #13241
2019-04-12 12:09:46 -07:00
Jacob Marble f56c42794b
chore(tracing): Cleanup (#13296)
* chore(tracing): Cleanup

* broken test

* fix unused var

* fix test
2019-04-10 19:28:21 -07:00
kelwang be674622c6
Revert "fix(inmem): remove the old inmem implementation" 2019-04-09 14:24:40 -04:00
kelwang d0022dfd5c
Merge pull request #13039 from zhulongcheng/rm-inmem-impl
fix(inmem): remove the old inmem implementation
2019-04-09 13:06:50 -04:00
jlapacik 0cde401678 refactor(storage): update GetSource method of Store interface 2019-04-08 15:59:37 -07:00
jlapacik 8078b915fd refactor(storage): ReadFilter storage operation 2019-04-08 15:59:37 -07:00
zhulongcheng cacd6a8223 fix(inmem): replace inmem.Service with kv.Service 2019-04-08 15:18:38 +08:00
Ben Johnson 307bb6af9c
Improve bulk series file writes. 2019-04-05 14:38:58 -06:00
Jeff Wendling 5d594deb2d
Merge pull request #13094 from influxdata/jmw-protobuf-bump
chore: bump gogo/protobuf and regenerate
2019-04-04 14:35:38 -06:00
jlapacik 2909927ab0
fix(reads): HasFieldValueKey searches for "$", not "_value" (#13138)
Storage converts references to _value in filter predicates to $.
It then considers any predicate that does not reference $ to be
a tag predicate. Tag predicates are used to construct series index
cursors.

This commit fixes a bug where field comparisons were being included
in tag predicates due to the HasFieldValueKey function searching
for comparison expressions referencing _value instead of $. Because
all references to _value had already been replaced. An expression
of the form '$ < 3000' would be considered a tag expression and
therefore would be mistakenly included as a tag predicate.

Fixes #13159.
2019-04-04 11:13:09 -07:00
Jeff Wendling 5dc3e52fd9 chore: bump gogo/protobuf and regenerate
It had been bumped previously from v1.1.1 to v1.2.0 and nothing was
regenerated. This bumps it to v1.2.1 and regenerates.
2019-04-03 15:42:33 -06:00
Jeff Wendling 157c4fcf0c storage: add tests for retention metrics 2019-04-01 17:44:37 -06:00
Jeff Wendling 3e370b0f99 storage: make retention metrics global
In the case that there are multiple engines, we want the retention
metrics from all of them.
2019-04-01 17:44:37 -06:00
Jacob Marble 0b626beb53
chore(storage): Don't log every read request (#12881)
* don't log every read request

* check for err
2019-03-25 13:14:45 -07:00
Stuart Carnie 8abb76cb4e
Merge pull request #12710 from influxdata/sgc/data-gen
Add data generation subcommand to influxd
2019-03-20 11:08:49 -07:00
Lorenzo Affetti 7dbecfa256
fix(storage/reads): release arrow buffers when advancing on table (#12737) 2019-03-20 15:48:59 +01:00
Stuart Carnie fe8b63c10b
chore(gen): Update the gen package to produce 2.0 series keys 2019-03-19 20:35:02 -07:00
Stuart Carnie 07aef958f8
fix(reads): Interface to identify a remote streamed cursor
A cursor can be in process (local) or remote. Remote cursors have
already applied the `hasPoints` check, to reduce network traffic.
Testing whether the cursor has points again here:

https://github.com/influxdata/influxdb/blob/master/storage/reads/reader.go#L221

will always return `false` for a remote cursor that has applied the
NoPoints optimization.

This temporary fix allows the `hasPoints` function to differentiate
a streamCursor and always return true in that case.
2019-03-11 18:40:35 -07:00
Jacob Marble 603a1f26e0 use tracing.StartSpanFromContext 2019-03-07 12:12:31 -07:00
Jacob Marble 9541e861a3 goimports -w -local github.com/influxdata/influxdb 2019-03-07 12:12:31 -07:00
Jacob Marble 92fa813c45 add spans to multiple services 2019-03-07 12:12:31 -07:00
Christopher M. Wolff e28ecdc0e9
refactor(query): make queryd present ProxyQueryService (#12360)
Fixes influxdata/idpe#2014.
2019-03-07 07:32:13 -08:00
Edd Robinson 582ed6834c ddress PR feedback 2019-03-07 09:56:07 +00:00
Edd Robinson 098ec71919 Remove erroneous print 2019-03-07 09:56:07 +00:00
Edd Robinson 8bdf857ddb Fix expected flux cases 2019-03-07 09:56:07 +00:00
Edd Robinson 3f1bec0836 Update emitted keys and tests 2019-03-07 09:56:07 +00:00
Edd Robinson f21be142d1 Storage engine now validates all tags are utf-8
The storage engine will now drop any points that contain invalid tag
data. Special tag keys for the measurement and field key will be
excepted from this validation.
2019-03-07 09:56:07 +00:00
Edd Robinson 9949fef2a5 Only validate tag pairs are valid unicode
We will want to validate that all tag key/value data is valid unicode.
This commit changes the validation helper to only validate provided
tags, since measurements are currently very likely to contain invalid
utf-8 characters.

There are two exceptions to the tag validation: the validation of the
special tag keys for measurements and field keys.
2019-03-07 09:56:07 +00:00
Edd Robinson f029f1645d Change location and value for internal tag keys 2019-03-07 09:56:07 +00:00
Jonathan A. Sternberg 9549cc4d97
fix(storage/reads): track memory allocations when reading from storage (#12404) 2019-03-06 15:29:45 -06:00
Jeff Wendling f53f9cd949 storage: detect conflicting types in a single batch of points
When the WAL was moved up, the validation that happened at the cache
was skipped. This moves the field type validation for a batch of
points up ahead of the WAL again.
2019-03-06 10:30:52 -07:00
Stuart Carnie da24fe6c7f feedback(reads): Clear r.buf before read 2019-03-05 11:45:51 -07:00
Stuart Carnie acc94985e3 fix(reads): Add retry when fetching data from StreamReader
It is possible a StreamReader (gRPC) may return an empty response. This
change adds retry and bail-out support. When a bail-out occurs,
reads.ErrStreamNoData is returned.
2019-03-05 11:45:51 -07:00
Stuart Carnie 28976e9b92 feat: Allow StreamReader to provide cursors.CursorStats
StorageReadClient adapts a gRPC Storage_ReadClient to provide
cursors.CursorStats by reading the trailer after receiving the final
message from the stream.
2019-03-05 11:45:51 -07:00
Stuart Carnie 5f241e5e5e fix(reads): Read Statistics before calling Close 2019-03-05 11:45:51 -07:00
Jacob Marble b9c7ec439e
feat(influxd): Tracing refactor (#12318)
* feat(launcher): Tracing to log disabled by default

* remove traceLogger and use opentracing directly

* add Jaeger tracing

* go vet && go fmt
2019-03-04 11:48:11 -08:00
Jeff Wendling 0fae44e219 storage: fix problems with keeping resources alive
This commit adds the pkg/lifecycle.Resource to help manage opening,
closing, and leasing out references to some resource. A resource
cannot be closed until all acquired references have been released.
If the debug_ref tag is enabled, all resource acquisitions keep
track of the stack trace that created them and have a finalizer
associated with them to print on stderr if they are leaked. It also
registers a handler on SIGUSR2 to dump all of the currently live
resources.

Having resources tracked in a uniform way with a data type allows us
to do more sophisticated tracking with the debug_ref tag, as well.
For example, we could panic the process if a resource cannot be
closed within a certain time frame, or attempt to figure out the
DAG of resource ownership dynamically.

This commit also fixes many issues around resources, correctness
during error scenarios, reporting of errors, idempotency of
close, tracking of memory for some data structures, resource leaks
in tests, and out of order dependency closes in tests.
2019-02-28 10:22:01 -07:00
Jonathan A. Sternberg 70507670c3
feat(storage/reads): add scanned values and bytes metadata to the query (#12156)
This updates influxdb to use the new arbitrary metadata that can be
attached by a source and adds metadata entries for the cursor
statistics.
2019-02-25 14:44:18 -06:00
Michael Desa 0d3d0d4d78
chore(influxdb): add context to storage.PointsWriter 2019-02-25 11:11:20 -05:00
Stuart Carnie 662887c679 feedback: Simplify reader; use constants from influxdb package 2019-02-21 11:18:08 -08:00
Stuart Carnie 01b5fccfbe feat(storage): Enforce single org for series key reads 2019-02-21 11:18:08 -08:00
Alirie Gray 5f524eb92d Rename all occurences of Macro to Variable 2019-02-14 13:21:57 -08:00
Jeff Wendling 3bb765279b storage: respond to review comments 2019-02-04 12:26:26 -07:00
Jeff Wendling 3014733b20 chore: fix staticcheck issues 2019-02-04 10:32:52 -07:00
Jeff Wendling 376b347d56 wal: change deletes to be based on DeleteBucket 2019-02-04 10:32:52 -07:00
Jeff Wendling 7f54e816e3 refactor: have retention use DeleteBucketRange 2019-02-04 10:32:52 -07:00
Jeff Wendling aa12144fc7 storage: replay the WAL through the whole engine 2019-02-04 10:32:52 -07:00
Jeff Wendling 6deced1215 refactor: make the WAL part of snapshots again 2019-02-04 10:32:52 -07:00
Jeff Wendling 2989936d5a refactor: write to the WAL again 2019-02-04 10:32:52 -07:00
Jeff Wendling 2f46937527 refactor: move value package up to tsdb 2019-02-04 10:32:52 -07:00
Jeff Wendling 8dbd98ccbe refactor: change the way the engine opens and closes and reload the cache
Open and Close now proceed as best as they are able to in the presence
of errors and clean up appropriately.
2019-02-04 10:32:52 -07:00
Jeff Wendling d2ddd48eea refactor: hook up metrics and wal to storage engine
It turns out that LastModified and DiskSize are unused, and so it
was easy to change to not care about the WAL.

This hooks up metrics and starts the WAL again.
2019-02-04 10:32:52 -07:00
Jeff Wendling 95de3d52b2 refactor: use concrete WAL in tsm1
At the cost of some nil checks, we don't have to have an interface, defend against
subtle bugs with nils in non-nil interfaces, an empty implementation, etc.

Also, the tsm1 engine is losing the WAL anyway.
2019-02-04 10:32:52 -07:00
Jeff Wendling c9bb55b889 refactor: move the tsm1/wal into the storage/wal package
Because the WAL relies on the tsm1.Value type, we move that into its own
tsm1/value package and set up some aliases forwarding them into tsm1. This
also required adding some methods and changing consumers to avoid the
unexported fields. I imagine this step will be useful one day when we make
the write path more efficient with respect to consuming points.

This commit additionally fixes some issues with generation. The iterator.tmpldata
and generation for array_cursor_* were removed accidentally when removing
iterators, making those generated files stale. Restore that and regenerate.

No change in functionality.
2019-02-04 10:32:52 -07:00
Nathaniel Cook 8372859dee Merge branch 'master' into flux-staging 2019-01-15 08:35:59 -07:00
Nathaniel Cook d0603457b7 refactor(flux): make packages mirror Flux namespaces 2019-01-14 18:00:45 -07:00
Edd Robinson b025d9afa9 Improve efficiency of TSI index series drop
This commit improves the performance of a mass delete on the TSI index
by deleting at the measurement level instead of deleting each series
individually.
2019-01-14 12:46:55 +00:00
Edd Robinson 9e11602b6a Add DeleteBucket benchmark 2019-01-14 12:46:55 +00:00
Nathaniel Cook 1708a41fa7 refactor: update query functions for Flux builtins 2019-01-11 13:11:57 -07:00
Jonathan A. Sternberg a59e6b8d25 refactor: rename DoArrow to Do (#2372)
See influxdata/flux#783 for details.
2019-01-10 10:30:25 -07:00
Mark Rushakoff d73d73c0d4 chore: rename imports from platform to influxdb
I did this with a dumb editor macro, so some comments changed too.

Also rename root package from platform to influxdb.

In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.

Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
2019-01-09 20:51:47 -08:00
Jeff Wendling 703c3c15ca Hook up DeleteBucket to the tsm1 engine 2019-01-09 15:24:26 -07:00
Edd Robinson 42ff769f1c Wire up storage.Engine to HTTP BucketService 2019-01-09 15:09:56 +00:00
Edd Robinson e3ae256782 Add storage bucket service
The storage bucket service wraps another bucket service, and invokes
actions on a storage engine based upon the actions taken upon buckets.

Currently, the storage bucket service will delete bucket data from the
storage engine when the bucket is deleted via the bucket service.
2019-01-09 13:35:25 +00:00
Edd Robinson 5a12a3a72e Export access to bucket drop in engine 2019-01-09 13:35:07 +00:00
Nathaniel Cook 89f4525841 build(Makefile): fix various bug with makefiles
Fixes subdir ordering.
Works around issue with stringer not working with Go modules.
Fixes issues with generated code being ignored.

Fixes #2044
2018-12-19 17:02:19 -07:00
Nathaniel Cook d6c0a393b0 Merge branch 'master' into flux-staging 2018-12-19 11:30:55 -07:00
Nathaniel Cook 61e36cbee6 chore(Makefile): add target to check generated files are accurate
A standard Makefile is used now in all subdirs that run go generate.
Make will only generate the file if its source files changed.
The checkgenerate target runs clean to ensure all targets a generated
fresh.
2018-12-18 12:54:17 -07:00
Jonathan A. Sternberg cc93531400 fix(storage): convert the storage table interface to use arrow buffers
The table interface was modified to expose the arrow buffers. The
storage table has now been converted to use this interface with the same
fixes so that it exposes arrow buffers.

The influxql package has also been updated to use the `DoArrow` method
from the `flux.Table` interface.
2018-12-18 09:47:53 -07:00
Ben Johnson 0541d568bd
fix(storage): Extend lock during stats fetch to prevent race 2018-12-13 11:13:20 -07:00