Commit Graph

396 Commits (e9689b7269bc219bd75a1d3a51770de257b2c8e8)

Author SHA1 Message Date
Max U 64747e9781 refactor(tsi1): address config changes to report-tsi tool 2019-08-05 10:03:32 -07:00
jlapacik 945f16ff4b docs(tsm1): TagKeys and TagValues return partial results with non-nil errors 2019-08-01 13:47:11 -07:00
jlapacik e7a0068e46 fix(tsm1): TagKeys/TagValues returns when context canceled 2019-08-01 13:47:11 -07:00
jlapacik 66662dca7f test(tsm1): TagKeys/TagValues stops scanning when context is canceled 2019-08-01 13:47:11 -07:00
Adam Perlin 4fef1683a0 refactor(tsi1): address review comments for report-tsi tool 2019-07-26 16:21:11 -07:00
Adam Perlin a0f4d714ea chore(tsi1): rename tsi1_report.go -> report.go 2019-07-26 11:17:02 -07:00
Adam Perlin d47a578258 fix(tsi1): map org to bucket in report-tsi tool so output is more useful 2019-07-26 11:17:02 -07:00
Adam Perlin 7ce1b8109f chore(tsi1): Clean up flags and naming in report-tsi tool; add comments 2019-07-26 11:16:59 -07:00
Max U 9bd6200f15 fix(tsi1): make mergeable 2019-07-26 11:16:12 -07:00
Max U 2c1f3e2987 fix(tsi1): remove obnoxious log messages 2019-07-26 11:16:12 -07:00
Max U 17b1dd8562 feat(tsi1): add shorthand for --top flag as -t, plus cleaning 2019-07-26 11:12:15 -07:00
Max U aa2f7a8ff7 feat(tsi1): add a --top flag for limiting output, output now sorted 2019-07-26 11:12:15 -07:00
Adam Perlin 32b283d25a feat(tsi1/report): Add ability to filter by measurement; add additional maps for efficient retrieval of total org/bucket cardinalities 2019-07-26 11:12:15 -07:00
Max U 5e5fa96c5b feat(tsi1): add flags for --org-id and --bucket-id 2019-07-26 11:12:15 -07:00
Max U bfd38d93d8 feat(tsi1): provide API tooling for use in testing 2019-07-26 11:12:15 -07:00
Max U 8f99d20deb feat(tsi1): port report-tsi tool to influxdb 2.x 2019-07-26 11:12:15 -07:00
Max U eb6d0f4478 feat(tsi): report cardinality for all indexes, still needs to be cleaned
Fix iteration logic and clean up
2019-07-26 11:12:00 -07:00
Max U 36e578122e feat(tsi): placeholder 2019-07-26 11:11:22 -07:00
Max U 41cc23cc35 fix(tsi1): clean up some error checking 2019-07-26 11:10:47 -07:00
Max U b9ede87508 fix(tsi): error trace for engine failure, not working 2019-07-26 11:09:40 -07:00
zhulongcheng fc1dc37886 fix(tsdb): add missing err in SeriesPartition.Open
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-07-26 10:48:32 +08:00
Max U 550da3c5a5 fix(fs): merge branch 'master' into HEAD 2019-07-25 10:23:48 -07:00
Edd Robinson ce3f58d9f0
Merge pull request #13787 from zhulongcheng/KeyCursor-overlapping
fix(tsm1): check if blocks are overlapping in KeyCursor.Next
2019-07-24 15:36:39 +01: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
Max U 979c075931 Merge branch 'master' into HEAD 2019-07-22 10:21:59 -07:00
kelwang 1d56544587
Merge pull request #14263 from zhulongcheng/keyRange
fix(storage): add key field to keyRange
2019-07-15 22:46:39 -04:00
Stuart Carnie 00561d5a1b
feedback: Move verify routines to `tsm1` package for consistency
Should have left it there to begin with 🤣
2019-07-09 09:00:41 +10:00
Stuart Carnie 46952afe37
feat(influxd): New influxd verify tsm-blocks command
This command performs verification of TSM blocks

* expected and actual CRC-32 checksums match
* expected and actual min and max timestamps match decoded
  data
2019-07-09 09:00:41 +10:00
Max U fe2aceb5e4 Merge branch 'master' into mu-tsm-clean-14058 2019-07-08 15:19:41 -04:00
Max U 6f14314e97 change log level from info to error 2019-07-08 14:49:14 -04:00
Max U 2202d727da fixes merge conflicts 2019-07-08 14:07:04 -04:00
maxunt ca5a599261
Merge branch 'master' into er-rename 2019-07-08 13:42:24 -04:00
Max U 39f51969e9 replaced os.Create calls w API calls to fs.CreateFile, includes unit test 2019-07-08 13:01:42 -04:00
Edd Robinson 12f2eeda1f fix(storage): ensure query range is (start, stop] 2019-07-05 17:10:56 +01:00
zhulongcheng 94d4c846a8 fix(storage): add key field to keyRange
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-07-05 00:14:19 +08:00
Ben Johnson 150165e92f
fix(tsdb): Fix tsm1 block merge. (#14254)
fix(tsdb): Fix tsm1 block merge.
2019-07-04 08:35:43 -06:00
Max U 948f04ef8d allow for compaction to same file with fs api 2019-07-03 14:28:27 -04:00
Max U c669a32ff3 change fs.RenameFile to fs.RenameFileWithReplacement when compacting partition stats files as they must go to the same place 2019-07-03 14:23:21 -04:00
Max U fe748128e3 replaces os.Rename calls w api calls to fs.RenameFile. tests now are failing 2019-07-03 13:14:43 -04:00
Ben Johnson 10a2063dcc
fix(tsdb): Fix tsm1 block merge.
Fixes the `tsm1.BlockIterator` so that it returns the current
key if there are still additional entries remaining. This previously
caused multiple entries not to be merged together during compaction
because the iterator would check if the next key matched the current
key but the key for the next set of entries was returned.
2019-07-03 10:08:51 -06:00
Stuart Carnie a42ff1628d
fix(influxd): --pattern flag matches specified substring
Previously the logic was inverted so `--pattern` matched
everything but the specified value.
2019-07-03 12:02:19 +10:00
Max U af257e93ff initial commit for clearing tsm files when replace fails 2019-07-02 13:48:31 -04:00
Ben Johnson 08e24faf4c
feat(tsdb): Add block exporter.
Adds export tooling to `influxd inspect export-blocks` so that we
can dump out block data in SQL format for better analysis during
the debugging process.
2019-07-01 10:10:52 -06:00
Tanya Gordeeva fe4333e8e0 fix(storage): fix tracking disk bytes in memory 2019-06-27 16:36:00 -07:00
Tanya Gordeeva 3ff15a8b41 fix(storage): fix counts for level 4+ files
The counts wreen't adding all the level 4+ files, so the last one to be counted
would override the rest.
2019-06-27 16:36:00 -07:00
Ben Johnson b3d7986d4b
chore(tsdb): Fix read metrics declaration. 2019-06-27 09:25:27 -06:00
Ben Johnson 12549c859e
feat(tsdb): Add basic tsdb read metrics
Adds a total cursor counter and seek location counter to a new
`readMetrics` that is added to each `Engine`. Default labels group
by `engine_id` and `node_id`.
2019-06-26 16:16:24 -06:00
tmgordeeva fb69c5d06c
Merge pull request #13698 from influxdata/tg-fix-metrics
fix(storage): reduce tsm level metrics cardinality
2019-06-20 17:57:37 -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
Tanya Gordeeva 85dc52a93b fix(storage): reduce tsm level metrics cardinality
This should have cut off TSM file levels at 4+.
2019-06-20 14:37:33 -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
Ben Johnson a181e60d70
fix(tsdb): Fix series file count (#13770)
fix(tsdb): Fix series file count
2019-06-11 10:07:12 -06:00
Christopher Wolff a82e2cb180 chore(tsdb): skip flaky test 2019-05-30 16:29:31 -07:00
Alirie Gray 576da8f9d2 fix(swagger): add log property to task runs endpoint docs 2019-05-17 14:08:10 -07:00
Nathaniel Cook faa5fddf7b Merge branch 'master' into flux-staging 2019-05-15 10:12:14 -06:00
Christopher Wolff 52a98aae2b chore(tsdb): skip flaky test
https://github.com/influxdata/influxdb/issues/13755
2019-05-14 12:52:37 -07:00
Jacob Marble 95f28cb571
fix(series file): Sync series segment after truncate (#13836) (#13859) 2019-05-10 11:25:43 -07:00
Jacob Marble aa5c77409d
backport: Fix open/close race in SeriesFile (#13837) 2019-05-08 11:39:24 -07:00
zhulongcheng fbd6e9f5c4 fix(tsm1): check if blocks are overlapping in KeyCursor 2019-05-04 22:25:09 +08:00
Edd Robinson 3588c0505e fix(storage): don't remap renamed TSM file
There exists a possibility for an in-flight read on a TSMReader to read
a stale reference to an mmapped TSM file index, which has become
unmapped.

This commit resolves that issue by simply renaming the file, leaving the
original file handler open and the data mapped. The path is updated so
that if any callers need to refer to the name of the TSM file after it's
renamed, the new name will be reflected.

The orphaned file handler will be closed when the TSM file is closed.
2019-05-03 22:36:35 +01:00
Ben Johnson a5ccf5ce9a
fix(tsdb): Fix series file count
Previously the series file did not include tombstones in the total
count. This commit now includes tombstones in the count as well as
fixes an issue where replayed tombstone records could exist but
their underlying ID did not exist. This caused the count to become
negative and with the count being `uint64` it caused the count to
rollover to `math.Uint64Max`.
2019-05-03 09:58:13 -06:00
Jeff Wendling ef0768db31
tsm1: predicate deletes (#13371)
tsm1: predicate deletes
2019-05-03 14:27:25 +00: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
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 740d669514 tsm1: teach the cache about predicates 2019-05-01 13:40:40 -06:00
Jeff Wendling 4fb7bf1730 tsm1: implement predicate matcher from protobufs 2019-05-01 13:40:40 -06:00
Jeff Wendling 4096f93891 tsm1: implement reading and writing predicates in tombstone files 2019-05-01 13:40:40 -06:00
Jeff Wendling dcf797f111 tsm1: basic predicate implementation at index layer
Only wires it up. No tests, no tombstone tracking, nothing.
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
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 65e4e3c5de
Merge pull request #13701 from influxdata/sgc/bp/2.x/13687
Don't panic when encoding string blocks and length of source slice is too large
2019-04-30 10:02:40 -07:00
Stuart Carnie 369a4610e6
fix(storage): Don't panic when length of source slice is too large
StringArrayEncodeAll will panic if the total length of strings
contained in the src slice is > 0xffffffff. This change adds a unit
test to replicate the issue and an associated fix to return an error.

This also raises an issue that compactions will be unable to make
progress under the following condition:

* multiple string blocks are to be merged to a single block and
* the total length of all strings exceeds the maximum block size that
  snappy will encode (0xffffffff)

The observable effect of this is errors in the logs indicating a
compaction failure.

Fixes #13687
2019-04-29 13:29:41 -07:00
Jeff Wendling 9cd7c0f7e3 tsi1: don't do verbose debug logging unless test fails 2019-04-29 14:01:45 -06:00
Stuart Carnie 7b97a41dcb
feat(storage): Teach TagKeys, TagValues how to accumulate statistics
This commit teaches the storage schema APIs how to track statistics
and make them available via the returned `cursors.StringIterator`.

Statistics are only tracked when decoding TSM blocks or when scanning
the in-memory cache.

Closes #13541
2019-04-24 11:14:22 -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 272f340c30
Merge point parse & explode. 2019-04-24 10:12:15 -06:00
Jeff Wendling 59279837e5 tsi1: partition close deadlock
When a tsi1 partition closes, it waits on the wait group for compactions
and then acquires the lock. Unfortunately, a compaction may start in the
mean time, holding on to some resources. Then, close will attempt to
close those resources while holding the lock. That will block until
the compaction has finished, but it also needs to acquire the lock
in order to finish, leading to deadlock.

One cannot just move the wait group wait into the lock because, once
again, the compaction must acquire the lock before finishing. Compaction
can't finish before acquiring the lock because then it might be operating
on an invalid resource.

This change splits the locks into two: one to protect just against
concurrent Open and Close calls, and one to protect all of the other
state. We then just close the partition, acquire the lock, then free
the resources. Starting a compaction requires acquiring a resource
to the partition itself, so that it can't start one after it has
started closing.

This change also introduces a cancellation channel into a reference
to a resource that is closed when the resource is being closed, allowing
processes that have acquired a reference to clean up quicker if someone
is trying to close the resource.
2019-04-22 09:06:32 -06:00
Tanya Gordeeva 97572ee878 feat(storage): add tsm level metrics
Adds prometheus metrics recording compaction levels for TSM files.
2019-04-19 13:33:52 -07:00
Stuart Carnie d5341a1a4a
feedback: Fix comments in template 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 904c91aecc
chore: Fix staticcheck complaints 2019-04-18 16:19:18 -07:00
Stuart Carnie d3790aa072
feat: Teach storage engine how to find tag values for a given key
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.

TagValues 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.
2019-04-18 16:19:18 -07:00
Stuart Carnie 35e0094a28
feat: TimeRangeIterator for checking if keys have data in a TSM file
The TimeRangeIterator permits linear or random index scans and
can answer whether the current key has data for the specified time
interval, considering any tombstones.

When there are no tombstones there are some opportunities for
optimization to skip decoding blocks. Specifically, if the
queried time interval overlaps any boundaries of the TSM index entries.
2019-04-18 16:19:18 -07:00
Stuart Carnie 7544ea0a5b
feat: Teach Values how to determine it contains data for a time interval
Add a Contains API which is a peer to the TimestampArray.Contains
function. This is used by the schema APIs to determine if data exists
in the cache for a given key and time interval.
2019-04-18 16:19:18 -07:00
Stuart Carnie 1ddd0445d8
feat(tsm1): Add Seek API to TSMIndexIterator
Permits random access of the iterator, correctly maintaining state,
so that Next may be called to iterator from a given key.

This API will be used by the schema APIs when a predicate is specified,
typically requiring random access.
2019-04-18 16:19:18 -07:00
Stuart Carnie 36a33bcb9f
feat(tsdb): Teach storage how to only decode timestamps from a block
TimestampArray.Contains(min,max) API performs a binary search to
determine if timestamps exist for the given time interval.

It also implements Exclude to drop timestamps that have been tombstoned.

DecodeTimestampArrayBlock decodes only the timestamps of the provided
block.
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
Stuart Carnie e74f2f8e08
chore(cursors): Remove unused field 2019-04-18 16:19:17 -07:00
Stuart Carnie d67b1ef245
fix(cursors): Add go:generate directive 2019-04-18 16:19:17 -07:00
Todd Persen 138c17f22c Fix typos in tsdb package 2019-04-17 12:55:38 -07:00
Ben Johnson 2b3ce82852
fix(tsdb): Remove TSI stats file cache
Removes the `STATS` file generated during TSI compaction as it had
potential for becoming inconsistent with the index data. Instead,
stats are recalculated on start up and on each compaction on a
per-partition basis.

Computing stats for 10M series across 10K measurements takes
approximately 0.171s.
2019-04-17 09:34:32 -06: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
Ben Johnson 307bb6af9c
Improve bulk series file writes. 2019-04-05 14:38:58 -06:00
Jeff Wendling 96a01eecf2 change an inaccurate comment 2019-03-30 10:24:15 -06:00
Jeff Wendling cbefaeb7f5 tsm1: make cache limit error a type
This makes it easier and more robust to check if an error is due
to the cache memory limit being exceeded.
2019-03-30 10:24:15 -06:00
Jeff Wendling 647deb475c tsm1: move cache entry to its own file 2019-03-30 10:24:15 -06:00
Jeff Wendling fad1e07d1d tsm1: clean up some dead/useless code in the cache
The storer interface isn't necessary if the init/Free logic is
removed, which is unnecessary in a world with only one shard.
Additionally, there were some cases where an init/Free call could
race and cause data loss in the cache. Not doing it at all fixes
all of those races.
2019-03-30 10:24:15 -06:00
Jeff Wendling 591e94dad9 tsm1: rings are fixed at 16 partitions
The code actually didn't work if 16 wasn't passed. Indeed, the
benchmarks weren't even working. Fix up all that, and reduce
the complexity some.
2019-03-30 10:24:15 -06:00
Jonas Hahnfeld 89ced057cb Fix compaction logic on infrequent cache snapshots
This change fixes #10511 that manifests when a shard is considered cold
faster than its cache is snapshotted. Previously the code only looked at
the last modification of compacted tsm1 files. Instead the (restored)
Engine.lastModified() also takes the cache into account.

Ports #10522 to master where engine.go has moved and Engine.LastModified()
was deleted because it was unused.
2019-03-28 22:21:59 +01:00