Commit Graph

1400 Commits (5263070632eeed600119ad96f865d2562e1133c4)

Author SHA1 Message Date
Stuart Carnie 790639d728 feat(tsm1): Add Read<Type>ArrayBlock APIs to TSMReader and mmapAccessor 2018-07-16 08:55:37 -07:00
Stuart Carnie 0841c51d93 pr(tsdb): Feedback items from PR review 2018-07-13 11:42:02 -07:00
Stuart Carnie 9cd31520ec feat(tsm1): Implement APIs to decode TSM data into array data structures
* These APIs will be used by `TSMReader` and `KeyCursor` types via new
  APIs, using similar naming convention (Array)
2018-07-13 11:42:02 -07:00
Stuart Carnie b3e53ae2dc feat(tsm1): New APIs to decode an entire buffer of data
* APIs decode an entire byte slice of encoded data into the provided
  `dst` slice
* APIs are stateless and in almost all cases avoid any allocations
* Intended to be used future batch-oriented TSM block decode APIs
* duplicated tests from original iterator-based APIs
2018-07-13 11:42:02 -07:00
Stuart Carnie 06257822c2 fix(tsm1): Reset vals to ensure Include is correctly tested 2018-07-13 11:42:02 -07:00
Stuart Carnie 7948a8e217 chore(tsm1): Add benchmarks for existing typed decoders
These benchmarks will be implemented in batched decoders to compare
performance.
2018-07-13 11:42:02 -07:00
Jeff Wendling 1c0e49e002 tsm1: ensure all written tsm files are fsynced
we were asserting to an *os.File in order to call Sync, but in some
cases the file handle has been wrapped, for example with limiting.
instead, assert to minimal interfaces for the functionality we need
and attempt to add some robustness in the code that creates the
writers by using a stronger interface with a Sync method.

fixes #9991
2018-06-25 11:36:22 -06:00
michaelyou 88ccbe43b3 Some typo and Wrong position of comment 2018-06-21 10:46:10 +08:00
David Norton b4fd65baf1 add digest logging 2018-06-15 16:55:59 -04:00
Jacob Marble 544636c815 TSM: Fix ShouldCompactCache without WAL 2018-06-13 17:37:17 -07:00
Jacob Marble 0dc5393441 tsm/cache: Remove unused function parameter 2018-06-13 15:22:37 -07:00
michaelyou 7c417818f4 Hash ring's hash mod 2018-06-07 12:03:01 +08:00
Jeff Wendling e6aec771b0 fix(tsdb): attempt to work on docker on windows
multiple users have attempted to run influxdb in a docker container
with a windows host and a volume mounted from windows. that causes
problems because it apparently uses samba/cifs which does not
support fsync on directories. this patchset will, if it receives an EINVAL
on directory fsync, as is what appears to happen on samba/cifs, then it
will ignore it. this should help.

fixes #9833.
fixes #9630.
2018-06-01 14:57:18 -06:00
Jacob Marble 82551a70e7
Merge pull request #9921 from influxdata/jgm-escape
buildtsi: Do not escape measurement names
2018-06-01 08:32:01 -07:00
Jacob Marble 9a7b652a1c TSM: OpenLimiter must not be nil 2018-05-31 13:43:16 -07:00
Jacob Marble 44c5da060b buildtsi: Do not escape measurement names
When `influx_inspect buildtsi` is used to create a new `tsi1` index, spaces in measurement names are escaped, so measurement "a b" is changed to "a\ b".

This change modifies `models.ParseKeyBytes()` and `models.ParseName()` to unescape measurement names. `models.ParseKeyBytes()` returns unescaped tag keys, so this seems like the natural place to unescape measurement names.

Also followed `scanMeasurement()` to see what other code could be problematic, and this should be everything (the result of one other use of `scanMeasurement()` is later escaped).

Removed `tsdb.MeasurementFromSeriesKey()`. These methods are exported, so checked for side effects in other InfluxData repositories.
2018-05-30 15:20:56 -07:00
Ben Johnson cec2a2d988
Merge pull request #9918 from influxdata/bj-tsm-open-limiter
TSM1 Open Limiter
2018-05-30 13:13:14 -06:00
Stuart Carnie 0253f6fe05 fix(tsdb/engine/tsm1): Fix panic when closing cursor multiple times
Fixes #9909
2018-05-29 09:59:52 -07:00
Jacob Marble bb313765e4 tsdb/tsm1: Clean up TSM filename format/parse 2018-05-29 09:57:48 -07:00
Ben Johnson d3e3b05a49
Add tsm1 open limiter
This commit restricts the number of TSM1 files that can be opened
concurrently across the entire `tsdb.Store`. There is currently
a limit for the number of shards that can be opened concurrently,
however, this limit does not help when the number of CPU cores
is higher than the number of shards. Because TSM1 files have a 2GB
limit and there is no limit on the number of files per shard,
extremely large shards (1TB+) can load 1,000s of files simultaneously.
2018-05-29 10:21:53 -06:00
Jeff Wendling 2b3cd8406f
Merge pull request #9892 from influxdata/jmw-tombstone-notifications
tsdb: observe tombstone files as well
2018-05-24 09:56:09 -06:00
Stuart Carnie e3d7095d14 fix(tsm1): Avoid searching index if key outside index bounds
This improvement avoids performing a binary search on the index by
first checking the key against the lower and upper bounds. Particularly
useful for multiple, fully-compacted TSM files.
2018-05-23 13:29:49 -07:00
Jeff Wendling ce565965a4 tsdb: avoid nil checks on the observer
this avoids nil panics in the case that someone eventually forgets.
2018-05-23 13:15:41 -06:00
Jeff Wendling 8ad515b387 tsdb: remove the shard id again
callers can always ensure that the observer set on the engine options
is appropriate for that shard id. this simplifies the api and reduces
the chance of bugs due to mixing up shard ids.
2018-05-23 13:04:54 -06:00
Jeff Wendling 15ae0bd98d tsdb: observe tombstone files as well 2018-05-22 22:07:16 -06:00
Jeff Wendling e62b1a02fb
Merge pull request #9879 from influxdata/jmw-add-shard-number-to-observer
tsdb: add shard number to the observer
2018-05-21 20:00:47 -06:00
michaelyou efc324681a Typo 2018-05-20 22:37:22 +08:00
Jeff Wendling eb4bf651e5 tsdb: add shard number to the observer
an observer may want to know what shard the file is part of. this
way, they don't have to rely on brittle file path parsing.
2018-05-18 18:15:44 -06:00
Jeff Wendling 6320316fd4
Merge pull request #9852 from influxdata/jmw-tsm-notifications
file store: send notifications about new/deleted tsm files.
2018-05-18 11:29:34 -06:00
Jacob Marble 735aa2d7dc Add SeriesIDSet() to Index interface 2018-05-18 09:22:43 -07:00
Jacob Marble 3f2ff742c0 Remove unused 'database' field 2018-05-18 09:22:43 -07:00
Jeff Wendling 27040d6f31 file store: send notifications about new/deleted tsm files.
just adds some interface for hooks about when these files come and go.
we do them before the action is taken so that if the hook has an
error, it doesn't have any consistency problems.
2018-05-17 12:19:58 -06:00
Jacob Marble c119f9a846 Close TSMReaders from FileStore.Close after releasing FileStore mutex 2018-05-17 09:12:36 -07:00
Jeff Wendling 3fc40dd4a0
Merge pull request #9824 from influxdata/jmw-optimize-radix
radix: optimize for our use case
2018-05-16 13:43:30 -06:00
Jeff Wendling 1a8931af42
Merge pull request #9841 from influxdata/jmw-ensure-no-race-conditions
tsm1: ensure some race conditions are impossible
2018-05-16 11:56:10 -06:00
Ben Johnson 8838d284a5
Merge pull request #9826 from influxdata/bj-tsm-filename
TSM Filename Injection
2018-05-15 15:50:26 -06:00
Jacob Marble 7f8b7af61e
Cleanup index memory footprint counting code (#9828)
* Fix IndexSet.DedupeInmemIndexes

* Cleanup index memory footprint code
2018-05-15 11:25:19 -07:00
Jeff Wendling 7d2bb19b74 tsm1: ensure some race conditions are impossible
The InUse call on TSMFiles is inherently racy in the presence of
Ref calls outside of the file store mutex. In addition, we return
some TSMFiles to callers without them being Ref'd which might allow
them to be closed from underneath. While I believe it is the case
that it would be impossible, as the only thing that gets a handle
externally is compaction, and compaction enforces that only one
handle exists at a time, and thus is only deleted once after the
compaction is done with it, it's not very obvious or enforced.

Instead, always return a TSMFile with a Ref call under the read
lock, and require that no one else calls Ref. That way, it cannot
transition to referenced if the InUse call returns false under the
write lock.

The CreateSnapshot method was racy in a number of ways in the presence
of multiple calls or compactions: it did not take references to the
TSMFiles, and the temporary directory it creates could have been
shared with concurrent CreateSnapshot calls. In addition, the
files slice could have been concurrently mutated during a compaction
as well.

Instead, under the write lock, make a local copy of the state for
the compaction, including Ref calls (write locks are implicitly
read locks). Then, there is no need for a lock at all afterward.

Add some comments to explain these issues at the call sites of InUse,
and document that the Files method that returns the slice unprotected
is only for tests.
2018-05-14 19:45:42 -06:00
Ben Johnson 35a64dee99
Inject tsm file naming. 2018-05-14 10:46:38 -06:00
Jeff Wendling cb9c3ee509 radix: optimize for our use case
- reduce allocations by making leaf a value type with a bool
- make longestPrefix inlineable and have no bounds checks
- delete any code for functions we don't plan to use
- operate on []byte and only copy when necessary
- inline calls to sort.Search to avoid allocations and indirections
- insert directly in the correct location for addEdge
- reduce allocations during copying with a buffer helper

results:

name              old time/op    new time/op     delta
Tree_Insert-8       1.10ms ± 4%     0.73ms ± 4%  -33.54%  (p=0.000 n=10+10)
Tree_InsertNew-8    3.18ms ± 2%     1.91ms ± 6%  -39.90%  (p=0.000 n=10+10)

name              old speed      new speed       delta
Tree_Insert-8     9.12MB/s ± 4%  13.72MB/s ± 4%  +50.46%  (p=0.000 n=10+10)
Tree_InsertNew-8  3.15MB/s ± 2%   5.24MB/s ± 6%  +66.42%  (p=0.000 n=10+10)

name              old alloc/op   new alloc/op    delta
Tree_InsertNew-8    1.62MB ± 0%     1.60MB ± 0%   -1.28%  (p=0.000 n=10+9)

name              old allocs/op  new allocs/op   delta
Tree_InsertNew-8     35.0k ± 0%      15.0k ± 0%  -57.04%  (p=0.000 n=10+10)

MB/sec in this case is 1 byte per key inserted, so it's really millions
of keys inserted per second.
2018-05-11 11:56:11 -06:00
Jacob Marble 0763d1789e Get inmem index bytes without double-counting 2018-05-10 11:33:52 -07:00
Jason Wilder de58584ce7
Merge pull request #9748 from influxdata/jw-series-type
Prevent series type conflict
2018-05-10 07:05:45 -06:00
Jacob Marble 148341fb2a tsdb/WAL: Better respect for WAL disabled 2018-05-08 15:04:33 -07:00
Jonathan A. Sternberg 6607c29a02
Merge pull request #9649 from influxdata/js-eval-functions-in-where
Allow math functions to be used in the condition
2018-05-02 08:29:08 -05:00
Jason Wilder aea9bf3464 Hide series type map behind feature flag
The performance is not good enough to enable by default so this
allows the functionality to be merged while performance is improved.
2018-05-02 06:50:35 -06:00
Jason Wilder ec3f5c353c Fix panic in FileStore.walkKeys
If a TSM file is replaced while walkKeys is running, a panic could
occur because the mmap has been unmapped.
2018-04-30 17:26:23 -06:00
Jason Wilder 2be2418b89 Add series type validation to Engine
This is the start of per-series validation that occurs in the
Engine write path.  It uses an in-memory radix tree to reduce
memory usage and is re-built on demand the first time a series
is written.
2018-04-30 17:26:23 -06:00
Ben Johnson f459d87325
Merge pull request #9785 from influxdata/rename-bad-tsm-file
Rename & log corrupt tsm files on load
2018-04-30 15:37:45 -06:00
Jacob Marble 63b9c98187 fix tests by closing iterators and cursors 2018-04-30 13:46:03 -07:00
Jacob Marble 7de2dcd3d9 TSM: TSMReader.Close blocks until reads complete 2018-04-30 13:46:03 -07:00
Stuart Carnie e0ae9c5a2d tsm1: Replace goroutine `merge` with k-way merge
Previously replaced WalkKeys implementation for a considerable
improvement to startup time
2018-04-30 07:57:55 -07:00
Ben Johnson 108fa09439
Rename corrupt tsm files on load. 2018-04-27 14:27:44 -06:00
Jonathan A. Sternberg 1f9227e20c Allow math functions to be used in the condition 2018-04-10 10:55:34 -05:00
Jason Wilder 97ecf62ffb Return time range from delete predicate func
This moves the time range to delete to be returned by the predicate
func in DeleteSeriesRangeWithPredicate.  It allows for a single delete
to delete different ranges of times per series instead of a single
range of time for all series.
2018-04-09 20:01:33 -06:00
Jonathan A. Sternberg bf0eb140ec
Merge pull request #9686 from influxdata/js-tsm1-aggregate-benchmarks
Adding additional aggregate benchmarks for tsm1
2018-04-09 11:08:57 -05:00
Jonathan A. Sternberg 117aac4b9e Adding additional aggregate benchmarks for tsm1
This will help us address performance problems in the underlying tsm1
implementations of the aggregate iterators.
2018-04-09 10:37:33 -05:00
Jason Wilder 8cc2e68d3b Fix panic in readTombstoneV4
The length check was backwards so if a series key was longer than
4096 bytes, it would cause a slice out of bounds panic.
2018-04-05 22:15:54 -07:00
Adam 72bceca888
Fix stream package to allow for renaming the file before writing it to the stream (#9684)
* Fix stream package to allow for renaming the file before writing it to the stream

* updated test to make sure that the final tsm file has more than one block
2018-04-05 16:24:29 -04:00
Mark Rushakoff b3c2d9290f Log error encountered when reading WAL files
Inspired by #9657.
2018-03-30 09:40:58 -07:00
Ben Johnson db9d32e514
Ignore index size in Engine.DiskSize().
TSM includes index in DiskSize(), however, indexes are not copied
and shouldn't be included in this method. This causes issues with
`copy-shard`.
2018-03-29 13:03:48 -06:00
Jacob Marble 470ee7f176 Add ability to delete many series with predicate 2018-03-28 08:32:18 -07:00
Jason Wilder 477de23e35
Merge pull request #9609 from influxdata/jw-compaction-filter
Add capability change compaction planner
2018-03-22 07:30:52 -06:00
Jason Wilder 0eb6564e79 Add extension point to swap out the compaction planner 2018-03-21 15:51:00 -06:00
Stuart Carnie aa61359cc7 Storage RPC API improvements. See PR for details
* reduce # allocations (115M -> 22M)
* reduce size allocations (53GB -> 1.3GB)
* reduce RPC query time (45s -> 12.9s)
2018-03-21 13:46:09 -07:00
Ben Johnson 2a8ca9a10e
Revert "Use MADV_WILLNEED when loading TSM files"
This reverts commit ee270e1dd2.
2018-03-21 13:26:45 -06:00
Mark Rushakoff 426a9a0b8b Use math/bits exclusively instead of go-bits
We won't be rolling back to pre-Go1.9, so prefer the standard library
over a dependency that provides backwards compatibility.
2018-03-15 12:03:24 -07:00
Edd Robinson 0fc7643d59 Fix data race in WAL
This commit fixes a data race in the WAL, which can occur when writes
and deletes are being executed concurrently. The WAL uses a buffer pool
of `[]byte` when reading the WAL. WAL entries are unmarshaled into these
buffers and passed along to the relevant methods handling the different
types of entry (write, delete etc).

In the case of deletes, the keys that need to be deleted were being
stored for later processing, however these keys were part of the backing
array of initial buffer from the pool. As such, those keys could be
written to at a future time when handling other parts of the WAL.
2018-03-15 12:51:30 +00:00
Jason Wilder 0c630a3cb5
Merge pull request #9461 from CAFxX/patch-2
Do not drop on the floor small buffers
2018-03-12 16:55:34 -06:00
Edd Robinson 7c3ae91d1e
Merge pull request #9551 from influxdata/er-fieldset-panic
Fix panic when checking fieldsets
2018-03-12 17:28:58 +00:00
Jason Wilder 444ad747b6 Add option to disable WAL
This adds an internal option (not exposed via config) to disable the WAL
when using the TSM engine directly.
2018-03-12 09:48:11 -06:00
Edd Robinson c1e1412dae Don't panic when checking for field 2018-03-12 15:25:20 +00:00
Edd Robinson 3086f02b2e
Merge pull request #9490 from influxdata/er-time-test
Support less granular mtime in LastModified test
2018-02-28 10:14:39 +00:00
Stuart Carnie e493a3e1db use child logger 2018-02-27 20:27:24 -07:00
Edd Robinson 45af822200 Support less granular mtime 2018-02-27 16:12:59 +00:00
Stuart Carnie 48fb2a4cc5
Merge pull request #9487 from influxdata/sgc-tagsets
fallback to inmem TagSets implementation
2018-02-27 09:06:54 -07:00
Stuart Carnie b72e0c5941 fallback to inmem TagSets implementation 2018-02-27 07:49:51 -07:00
Edd Robinson 96c0ecf618 Improve startup time of `inmem` index
This commit improves the startup time when using the `inmem` index by
ensuring that the series are created in the index and series file in
batches of 10000, rather than individually.

Fixes #9486.
2018-02-27 13:33:00 +00:00
Stuart Carnie b03cf6a953 prefix with `tsm1_` for consistency 2018-02-26 13:00:03 -07:00
Stuart Carnie a74d296200 use underscore vs period, fix doc comment, add database name to CQ 2018-02-26 10:08:43 -07:00
Stuart Carnie d40d3ecc2e
Merge pull request #9456 from influxdata/sgc-logging
Generate trace logs for a number of important InfluxDB operations
2018-02-21 15:09:18 -07:00
Stuart Carnie d135aecf02 Generate trace logs for a number of significant influx operations
* tsdb Store.Open traces all events related to opening files
    * op.name : tsdb.open
* retention policy shard deletions
    * op.name : retention.delete_check
* all TSM compaction strategies
    * op.name : tsm1.compact_group
* series file compactions
    * op.name : series_partition.compaction
* continuous query execution (if logging enabled)
    * op.name : continuous_querier.execute
* TSI log file compaction
    * op_name: index.tsi.compact_log_file
* TSI level compaction
    * op.name: index.tsi.compact_to_level
2018-02-21 15:08:49 -07:00
Jason Wilder fd90ec2b04 Remove noisy trace logging in TSM engine
This logging is noisy and allocates a lot of garbage.  There are
stats now that have the same information.
2018-02-21 12:51:01 -07:00
Jason Wilder a865e14455
Merge pull request #9470 from influxdata/jw-cur-close
Make closing TSM cursors idempotent
2018-02-21 09:34:13 -07:00
Jason Wilder fca3061f3c Make closing TSM cursors idempotent
Double closing a bufCursor would cause a panic.  There was also
some typed cursors that had the same problem.
2018-02-21 09:05:54 -07:00
Jonathan A. Sternberg d38413a849
Merge pull request #9454 from influxdata/js-structured-logging
Update logging calls to take advantage of structured logging
2018-02-21 09:14:40 -06:00
Jason Wilder f7279b57f3 Re-open last WAL segment
Re-open the last wal segment instead of creating a new one.  This fixes
an issue where the last modified time of the WAL would change on
restart.  It also avoids a lot of IO file churn on restart.
2018-02-20 14:24:04 -07:00
Jonathan A. Sternberg 2bbd96768d Update logging calls to take advantage of structured logging
Includes a style guide that details the basics of how to log.
2018-02-20 10:04:19 -06:00
Carlo Alberto Ferraris 228e17d79b
Do not drop on the floor small buffers
Currently if a buffer from the buffer is too small to satisfy its request then we simply drop it and allocate a new one.

This change puts it back in the pool and then allocates a new one.
2018-02-17 20:41:07 +09:00
Stuart Carnie 6e47ff8d7f simplify code 2018-02-14 06:55:48 -07:00
Edd Robinson 544329380f
Add empty series sketches back to tsi1 index
This commit adds initial empty sketches back to the tsi1 index, as well
as ensuring that ephemeral sketches in the index `LogFile` are updated
accordingly.

The commit also adds a test that verifies that the merged sketches at
the store level produce the correct results under writes, deletions and
re-opening of the store.

This commit does not provide working sketches for post-compaction on the
tsi1 index.
2018-02-07 14:52:13 -07:00
Stuart Carnie 0f6e6fb9ef
Merge pull request #9192 from influxdata/sgc-writer
ensure tsmWriter#Write returns ErrMaxBlocksExceeded
2018-02-01 15:39:01 -07:00
Jason Wilder 3299e549aa Increase WAL write buffer size
The default of 4096 results in writes to the WAL still requiring muliple
IOs.  We had previously bumped this to 1M, but that was too high when
there are many shards.  Increasing to around 16k reduces the IOs to
one or two for the workloads tested.  We may want to make this
configurable in the future.
2018-01-31 13:55:32 -07:00
Jason Wilder e9db11a3e9 Reduce cache partitions to 16
The large number of partitions cause big HeapInUse swings at higher
cardinality which can lead to OOMs.  Reducing this to 16 lowers
write throughput to some extent at lower cardinalities, keeps memory
more stable over the long run.
2018-01-31 13:55:32 -07:00
Jason Wilder ee270e1dd2 Use MADV_WILLNEED when loading TSM files
When the TSM index is large, this hints to the kernel to start
faulting in pages to avoid lots of smaller page faults.
2018-01-31 12:38:16 -07:00
Joe LeGasse 21a58235fc
Merge branch 'master' into jl-race 2018-01-29 15:52:18 -05:00
Edd Robinson 821b784fa0 Switch deprecated HasPrefix for raw string check 2018-01-21 12:08:25 -08:00
Edd Robinson 42c3adeffc simplify packages under tsdb 2018-01-21 09:41:27 -08:00
Edd Robinson 90903fa6ed Remove unused code/cleanup engine package 2018-01-20 13:56:45 +00:00
Jason Wilder 97f61e0ff4 Allow SeriesFile compaction to be disabled 2018-01-18 15:54:52 -07:00
Jason Wilder d755daede8 Add ability to enable/disable tsi compactions 2018-01-18 14:25:58 -07:00
Joe LeGasse 425a5e5f17 tsm1: prevent WaitGroup race 2018-01-17 13:08:11 -05:00
Joe LeGasse 140d5c3efa
Merge pull request #9327 from influxdata/jl-wal-lastmodified
wal: update lastWriteTime behavior
2018-01-17 11:54:33 -05:00
Joe LeGasse 129c2f0120 tsm: skipping LastModified test for now 2018-01-17 11:14:45 -05:00
Jason Wilder b05754fd23 Fix nil pointer panic
Under concurrent writes and deletes of the same series, a nil panic
could occur in bytes.Compare.  Instead of setting the seriesKeys to
nil, set them to an 0 length slice which prevents the panic.
2018-01-17 07:57:30 -07:00
Jason Wilder 5d6b8fc834 Drop measurement after series
This separates out the dropping of a measurement from the series
to avoid frequent checks to see if a measurement still has series.
The series are dropped individually and we keep track of which
measurements are involved and then delete each measurment afterwards.
2018-01-17 07:57:25 -07:00
Joe LeGasse 68e20c4f80 wal: update lastWriteTime behavior 2018-01-16 21:22:24 -05:00
Jason Wilder 1c8676b4a3 Rebuild corrupted fields index when necessary
If the fields.idx was corrupted in someway, it would cause the shard
to fail to load.  Deleting the file will allow it to be rebuilt.

This change handles this automatically so it's rebuilt if necessary
without user intervention.
2018-01-16 11:31:07 -07:00
Edd Robinson a2ece0a49a Pass series id in via Index API 2018-01-15 12:00:31 +00:00
Ben Johnson d295f30686 Remove series id check during deletion. 2018-01-15 12:00:31 +00:00
Edd Robinson bb6bfad5ea Ensure inmem index updated properly 2018-01-15 12:00:30 +00:00
Edd Robinson b9d0a39131 Skip empty series keys 2018-01-15 12:00:30 +00:00
Edd Robinson a4bef3a4bc Refactoring delete tests 2018-01-15 12:00:30 +00:00
Edd Robinson 74481b9415 Fix shard tests 2018-01-15 12:00:30 +00:00
Jason Wilder ba9a5af7eb Mark series deleted in series file
This commit adds the ability to correctly mark a series as deleted in
the global series file. Whenever a shard engine determines that a series
should be deleted, it checks with each shard's bitset for series that
are to be deleted and are no longer contained in any shard-local
bitsets.

These series are then removed from the series file.
2018-01-15 12:00:30 +00:00
Edd Robinson 286c8f4c09 Return to original DELETE/DROP SERIES semantics
This reverts commit 59afd8cc90.
2018-01-15 12:00:30 +00:00
Jason Wilder a4d13c7098 Update TestIndex_SeriesIDSet
The series ids are no longer lower than 4 so this test will always
fail.
2018-01-11 13:49:50 -07:00
Jason Wilder c2cbd14e09 Fix TestEngine_DisableEnableCompactions_Concurrent hang
This test could hang due to an existing race that is still not fixed.
The snapshot and level compaction goroutines woule end up waiting on
the wrong channel to be closed so whey would never exit.
2018-01-11 11:58:20 -07:00
Ben Johnson d610a79487
Merge pull request #9295 from influxdata/partition-series-file
Partition series file
2018-01-11 08:45:18 -07:00
Edd Robinson ecef790574 Update timeout on test 2018-01-11 11:41:30 +00:00
Edd Robinson ed8b9925c8 Comment update 2018-01-11 01:01:54 +00:00
Edd Robinson e2262d3e8e Implement series id tracking in TSI index 2018-01-11 01:01:54 +00:00
Edd Robinson e610e7c21d Track undeleted series IDs per-shard with inmem
This commit adds a bitset into each shard's in-memory index, to be used to
track undeleted series ids. Currently tsi1 support is not implemented.

When new series are added to the shard, the series id is added
to the bitset. When series are deleted from the shard, the series
ids are removed from the bitset.

Becasue each shard shares the same inmem index reference, the bitset
is stored in the `ShardIndex`, which is local to each shard, and then
different references are passed into the shared `Index` object, depending
on which shard is writing the series.
2018-01-11 01:01:54 +00:00
Ben Johnson 9bf45fcae0
Improve inmem insert performance with non-sequential series ids. 2018-01-10 13:08:16 -07:00
Adam 938db68198
Update restore functionality to run in online mode, consume Enterprise backup files. (#9207)
* Live Restore + Enterprise data format compatability

* Extended ImportData to import all DB's if no db name given

* Added a new enterprise data test, and backup command now prints the backup file paths at conclusion

* Added whole-system backup test

* Update to use protobuf in all enterprise data cases

* Update to test to do cross-testing with enterprise version

* incremental enterprise backup format support
2018-01-10 13:59:18 -05:00
Jason Wilder 92f86b1b8f Fix large memory spikes in cache
The cache defaulted to entry capacity size of 32.  This default
is fine for lower cardinalities, but causes big spikes in InUse
heap with higher cardinalities that can OOM the process.  Since
the hints had to be removed previously due to increased memory usage,
they are now completely removed.  For lower cardinalities, we do
grow the slice, but this has a small performance penalty compared
to the large memory usage/OOMs with larger cardinalities.
2018-01-10 07:56:46 -07:00
David Norton 1c452d83cb fix #9286: return digest size 2018-01-08 13:15:14 -05:00
Hans P. Bieker a85306c53e Updated mergeUnsigned by running "go generate ./tsdb/engine/tsm1". 2018-01-04 19:35:01 +01:00
Hans Petter Bieker 7a273ccdb5 Fixed issue where compacting did not sort when block are unsorted and overlapping. 2018-01-04 15:25:26 +01:00
Jason Wilder bf66f20388
Merge pull request #9267 from hpbieker/hpb-compacting-sorting
Sort blocks by time when compacting
2018-01-03 17:43:38 -07:00
Ben Johnson 98486a284a
Merge pull request #9265 from benbjohnson/series-file-compaction
Sequential series file id & series file segmentation
2018-01-03 10:05:59 -07:00
Ben Johnson 3900c948a2
Fix requested changes. 2018-01-03 10:04:12 -07:00
Edd Robinson f9ea54198f rename series directory 2018-01-03 15:44:58 +00:00
hpbieker c892bf15a1 Fix missing sorting of blocks when compacting. 2018-01-03 10:21:11 +01:00
hpbieker ee185e18b7 Added unit test TestCompactor_Compact_UnsortedBlocks. 2018-01-03 09:42:36 +01:00
Ben Johnson 52630e69d7
Integrate SeriesFileCompactor 2018-01-02 12:20:03 -07:00
Ben Johnson 56980b0d24
Segment series file 2017-12-29 11:57:45 -07:00
Stuart Carnie ed207b54c3 updates after TSI / series file merge 2017-12-29 10:58:25 -07:00
Stuart Carnie 455013a486 updates per PR review comments 2017-12-29 07:58:52 -07:00
Stuart Carnie 5dfe3b2645 inmem startup improvments
* only call ParseTags when necessary
* remove dependency on inmem.Series in tsdb test package
* Measurement and Series are no longer exported. Their use is restricted
  to the inmem package
* improve Measurement and Series types by exporting immutable
  fields and removing unnecessary APIs and locks

Reduced startup time from 28s to 17s. Overall improvement including
#9162 reduces startup from 46s to 17s for 1MM series across 14 shards.
2017-12-29 07:58:52 -07:00
Ben Johnson d8b1d208c0
rebase 2017-12-20 15:13:34 -07:00
Edd Robinson bde66f19bc Adjust series file size and partitions 2017-12-18 13:17:42 +00:00
Edd Robinson 38af43d5eb Fix engine test races 2017-12-15 23:19:18 +00:00
Edd Robinson 42ba4831ba Update Digest test 2017-12-15 18:45:20 +00:00
Edd Robinson c476a0b4a1 Merge branch 'master' into er-tsi-index-part 2017-12-15 18:31:24 +00:00
Edd Robinson 3bfe525705 Add 32-bit support to series file
This commit ensures that the series file should work appropriately on
32-bit architecturs. It does this by reducing the maximum size of a
series file to 512MB on 32-bit systems, which should be fully
addressable.

It further updates tests so that the series file size can be reduced
further when running many tests in parallel on 32-bit architectures.
2017-12-15 15:47:26 +00:00
Jason Wilder 2d85ff1d09 Adjust compaction planning
Increase level 1 min criteria, fix only fast compactions getting run,
and fix very large generations getting included in optimize plans.
2017-12-14 22:41:34 -07:00
Jason Wilder 749c9d2483 Rate limit disk IO when writing TSM files
This limits the disk IO for writing TSM files during compactions
and snapshots.  This helps reduce the spiky IO patterns on SSDs and
when compactions run very quickly.
2017-12-14 22:02:32 -07:00
Edd Robinson 59afd8cc90 Return to original DELETE/DROP SERIES semantics
Since possibly v0.9 DELETE SERIES has had the unwanted side effect of
removing series from the index when the last traces of series data are
removed from TSM. This occurred because the inmem index was rebuilt on
startup, and if there was no TSM data for a series then there could be
not series to add to the index.

This commit returns to the original (documented) DROP/DETETE SERIES
behaviour. As such, when issuing DROP SERIES all instances of matching
series will be removed from both the TSM engine and the index. When
issuing DELETE SERIES only TSM data will be removed.

It is up to the operator to remove series from the index.

NB, this commit does not address how to remove series data from the
series file when a shard rolls over.
2017-12-15 00:02:06 +00:00
Edd Robinson 9e3b17fd09 Ensure deleted series are not returned via iterators 2017-12-14 21:29:35 +00:00
Jason Wilder 7dc5327a0a Adjust snapshot concurrency by latency
This changes the approach to adjusting the amount of concurrency
used for snapshotting to be based on the snapshot latency vs
cardinality.  The cardinality approach could use too much concurrency
and increase the number of level 1 TSM files too quickly which incurs
more disk IO.

The latency model seems to adjust better to different workloads.
2017-12-13 13:17:56 -07:00