Commit Graph

428 Commits (ea0b097c31149cd537f89338f96951efcd0c6219)

Author SHA1 Message Date
Jonathan A. Sternberg 5aeca082c8
chore: update staticcheck and fix newly identified lint checks (#18737) 2020-06-26 18:54:09 -05:00
Ben Johnson 171f6586a0 fix(tsdb): Add refs for file-sourced tag keys
This commit adds ref counting for files that we pull tag keys from.
Previously, files were only ref counted during the time we extracted
tag keys but this commit adds additional ref counting for the life of
the `Engine.tagKeysNoPredicate()` function.
2020-06-17 10:27:23 -06:00
Ben Johnson 69fe9ed1ba
Merge pull request #17769 from patriczek/iss17257
fix: Migrated bucket should have correct retention policy.
2020-04-20 13:40:15 -06:00
Patrik Helia 07c89c9188 Fix fmt and reduce code
Signed-off-by: Patrik Helia <patrik.helia@kiwi.com>
2020-04-20 21:25:38 +02: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 69820c08a4
feat(tsdb): Add maximum timestamp to MeasurementField
This is require in order to correctly merge results from multiple
sources.
2020-04-16 14:51:30 -07:00
Patrik Helia 7ce7e62f60 fix: Migrated bucket should have correct retention policy.
Signed-off-by: Patrik Helia <patashelia@gmail.com>
2020-04-16 21:35:48 +02: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 cb618efc65
feat(tsm1): Implementation of MeasurementFields
This commit provides an implementation of the MeasurementFields
API per the design previously outlined.
2020-04-08 16:15:34 -07:00
Stuart Carnie 7de6383adf
refactor(tsm1): Allow race-free access to cache
This commit adds a new API to `Cache` to address data races
with the `TagKeys` and `TagValues` APIs.

`Cache` and `entry` provide `AppendTimestamps`, which
appends the current timestamps to the provided slice
to reduce allocations. As noted in the documentation,
it is the responsibility of the caller to sort and deduplicate
the values, if required.

The `cursors.TimestampArray` type was extended to permit
use of the `sort.Sort` API.
2020-04-08 16:15:05 -07:00
Stuart Carnie 31df76e1e9
refactor(tsm1): Add TimeRangeMaxTimeIterator
This commit introduces a new API for finding the maximum
timestamp of a series when iterating over the keys in a
set of TSM files.

This API will be used to determine the field type of a single
field key by selecting the series with the maximum timestamp.

It has also refactored the common functionality for iterating
TSM keys into `timeRangeBlockReader`, which is shared
between `TimeRangeIterator` and `TimeRangeMaxTimeIterator`.
2020-04-08 16:05:19 -07: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
Stuart Carnie 069820ba4b
fix(models): Added error return value; use iota; fix spelling 2020-04-02 08:34:22 -07: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
Stuart Carnie 37a97437e7
fix: Invariant violated: mixed block types for a single series
The root cause is that the Unsigned data type has no representation
in the valueType function in the cache and falls back to the default
case of 0.

0 is also a sentinel value in the entry#add function that will
result in skipping the value type check.

It therefore is possible that unsigned values followed by some other
data type is stored in the cache.

It is suspected that the write may be rejected before reaching the
cache, and therefore may not occur in practice. Specifically, the
series file stores the data types on a per-series basis and would
reject the write.

This commit turns the value types into explicit constants and
ensures all existing block types are represented. In addition,
it adds a mapping function to convert these to a known Block type,
which will be used by the `MeasurementFields` schema request to
determine the type of a series in the cache.
2020-04-01 18:42:22 -07:00
Ben Johnson 7d72b4e511 feat(tsdb): Bulk delete series performance improvement 2020-03-18 15:47:35 -06:00
Edd Robinson d96cbd4f74
Merge pull request #17016 from influxdata/er-bulk-import
feat(storage): prototype 1.x–2.x migration tooling
2020-03-18 17:57:26 +00:00
Jacob Marble 679215de97
chore: Revert "refactor(tsdb): remove read from unexported field (#17279)" (#17305)
This reverts commit 0ec2b453b9.

Fixes panic.
2020-03-16 17:48:01 -07:00
Jacob Marble 0ec2b453b9
refactor(tsdb): remove read from unexported field (#17279)
* refactor(tsdb): remove read from unexported field

* fix(tsdb): add regression test to check for panic

* fix(tsdb): detect nil without panic
2020-03-16 14:26:14 -07: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
Edd Robinson 5b437a2966 refactor: fix build 2020-03-13 15:24:53 +00:00
Edd Robinson 08add490e0 fix: ensure buckets are created properly 2020-03-13 11:00:28 +00:00
Edd Robinson bbe40aeb82 feat: prototype 1.x - 2.x migration tool 2020-03-13 11:00:28 +00: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
Jacob Marble b91e3f36ab
refactor(hll): remove unused Sketch interface (#17218) 2020-03-12 08:59:05 -07:00
Ben Johnson 627b6f86bb feat(storage): Series file compaction 2020-03-11 19:31:58 -06:00
Ben Johnson ce47e57089 fix(tsdb): Fix predicate clone 2020-02-04 10:12:26 -07: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
Stuart Carnie 13a248a4fb
fix(tsm1): Add multiple unit tests to verify correctness
This commit adds numerous tests for ascending and descending cursors
that generate merged blocks across multiple files, which exceed the
default fixed buffer size used by the array cursors (MaxPointsPerBlock).

Tests cover two scenarios

1. Each file has one block and the block from the second file is
   entirely contained within the first block of the first file.
   When merging, the new block is 1200 values, which exceeds the
   MaxPointsPerBlock.

2. Each file has multiple blocks, and the blocks have a mixture of
   values which interleave and overwrite.
2020-01-19 22:53:58 -07:00
Edd Robinson 91551302f9 fix(storage): ensure all block data returned
This commit prevents multiple blocks for the same series key having
values truncated when they are being read into an empty buffer.

The current cursor reader code has an optimisation that incorrectly
assumes the incoming array will be limited to 1,000 values (the maximum
block size), but arrays can contain values from multiple matching
blocks.
2020-01-19 22:03:20 +00:00
Edd Robinson f11504b987 fix(storage): prevent infinite loop in matcher
Fixes #15817

This commit addresses a potential infinite loop, caused
by series keys that contain a certain pattern of escaped
characters.
2020-01-14 15:05:07 +00:00
Edd Robinson a06dc0fd7f fix(storage): prevent data-races on predicate
Fixes #15817

This commit addresses several data-races on the `tsm1.Predicate` type
that were causing a live-lock or similar in rare cases during a delete.

Because `tsm1/FileStore.Apply` executes concurrently across TSM files
the state of the delete's predicate was being unsafely mutated.

This commit adds a `Clone` method to the `influxdb.Predicate` type,
which should be used whenever an `influxdb.Predicate` implementation
needs to be used concurrently.
2020-01-09 10:00:25 +00:00
Jacob Marble 5f19c6cace
chore: Remove several instances of WithLogger (#15996)
* chore: Remove several instances of WithLogger

* chore: unexport Logger fields

* chore: unexport some more Logger fields

* chore: go fmt

chore: fix test

chore: s/logger/log

chore: fix test

chore: revert http.Handler.Handler constructor initialization

* refactor: integrate review feedback, fix all test nop loggers

* refactor: capitalize all log messages

* refactor: rename two logger to log
2019-12-04 15:10:23 -08:00
Edd Robinson 2f86815f83 fix(storage): ensure field is 64-bit aligned 2019-11-22 13:44:58 +00:00
Edd Robinson 7146af61b0 fix(storage): enable package to build on 32-bit arch 2019-11-22 12:55:20 +00:00
Edd Robinson 2471c2468c fix(storage): fixes panic when building predicates
Fixes #15916.

If a predicate was passed in with multiple key/value matches for the
same tag key, then the value index would be incorrect. This ensures that
each tag key can only be added to the location map once.
2019-11-15 15:07:36 +00:00
Edd Robinson 0dd2d38eac fix(tsi1): index defect with negated equality filters
Fixes #15859

This commit fixes a defect in the TSI index where a filter using the
negated equality operator would result in no matching series being
returned for series stored within the `IndexFile` portions of the index.

The root cause of this was due to missing legacy-handling code in the
index for this particular iterator.
2019-11-12 13:26:23 +00:00
George 3804d50fbd
fix(storage): array cursor iterator should return stats of all observed cursors (#15731)
* fix(storage): add failing test for array cursor iterator stats

* fix(storage): make arrayCursorIterator.Stats() return stats of in-focus cursor

* fix(storage): add failing test to assert arrayCursorIterator.Stats() returns accumulated result

* fix(storage): assumulate stats in arrayCursorIterator.Stats() call across all observed cursors
2019-11-05 10:41:06 +01:00
Christopher Wolff 04bc7bf76b test(tsdb): skip flaky test
https://github.com/influxdata/influxdb/issues/15220
2019-10-30 10:40:03 -07:00
Edd Robinson dc78d7c0eb
Merge pull request #14373 from zhulongcheng/add-missing-err
fix(tsdb): add missing err in SeriesPartition.Open
2019-10-24 13:13:32 +01:00
Edd Robinson 2727ae3c25 refactor: simpify Semaphore interface 2019-10-23 19:49:48 +01:00
Edd Robinson b6e911d72c refactor: move goroutine out to function 2019-10-23 19:49:46 +01: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
Edd Robinson ef1e15a0ad
Merge pull request #15318 from influxdata/er-mv-comp-limiter
feat(storage): allow compaction limiter to be injected into engine
2019-10-09 13:11:44 +01:00