Commit Graph

2351 Commits (de87298e38febb0cef7d043d78cc805e15531f0b)

Author SHA1 Message Date
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
Jacob Marble 2dde4e6174
Fix broken unit tests after function signature change (#9848) 2018-05-15 16:22:24 -07: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
Ben Johnson a82efef9d1
Add OnNewEngine callback to EngineOptions. 2018-05-15 11:50:30 -06: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
Jacob Marble 200fda999f remove unused function parameters 2018-05-14 09:10:21 -07: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 5e4085a9df Correct godoc for SeriesFile.CreateSeriesListIfNotExists 2018-05-10 17:03:09 -07:00
Jacob Marble 0763d1789e Get inmem index bytes without double-counting 2018-05-10 11:33:52 -07:00
Jacob Marble e2f9413c8a count slice memory use with len, not cap 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
Jacob Marble 87d73d405c tsdb/SeriesFile: remove unused function param 2018-05-04 11:22:12 -07:00
Jacob Marble 2dc2b97fb9
tsdb/index: Add Bytes() methods (#9794) 2018-05-04 08:47:05 -07:00
Jeff Wendling cf81a3e66e
Merge pull request #9770 from influxdata/jmw-inspect-series-file
Add verify-seriesfile to influx_inspect
2018-05-02 11:27:53 -06: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
Jonathan A. Sternberg 10ed277e7a
Merge pull request #9791 from influxdata/js-spread-stream-function
Optimize the spread function to process points iteratively instead of in batch
2018-05-01 15:08:34 -05: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
Jacob Marble fa24142467 tsdb/indx/inmem: Fix megacheck issue 2018-04-30 10:25:07 -07:00
Jonathan A. Sternberg 9d049c4b62 Optimize the spread function to process points iteratively instead of in batch 2018-04-30 11:25:29 -05: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
Jacob Marble b23e32321c Remove unused code in tsdb/index/inmem 2018-04-26 13:19:01 -07:00
Jacob Marble 4282bf2744 Remove unused function parameter 2018-04-26 13:19:01 -07:00
Edd Robinson ba16268f41
Merge pull request #9777 from influxdata/er-index-log
Log information about index version during startup
2018-04-26 10:48:54 +01:00
Jeff Wendling c38108eb8a fix some megacheck errors 2018-04-25 18:14:25 -06:00
Jeff Wendling 9f09a3c1c2 add tests for verify_seriesfile
does some basic sanity checks. it's hard to be more exhaustive without
either taking a crazy amount of time, or being non-deterministic,
but at least this makes sure we barf in some cases.
2018-04-25 18:10:19 -06:00
Jeff Wendling e771040a7d Add verify-seriesfile to influx_inspect
Fixes #9767
2018-04-25 18:10:17 -06:00
Jeff d21365d804
Merge pull request #9762 from influxdata/jmw-abstract-measurement-validation
Add FieldValidator to allow custom validations on measurements

Fixes #9745.
2018-04-25 10:23:37 -06:00
Jacob Marble 1c63c4a3da Fix tsdb/index/inmem benchmark tests 2018-04-25 08:51:28 -07:00
Jeff Wendling e5dbc18d0b remove bool return param from dataTypeFromModelsFieldType 2018-04-25 09:48:24 -06:00
Edd Robinson 0b4a403679 Provide warning when mixed index used on db 2018-04-25 13:57:08 +01:00
Edd Robinson 32e195860b Log index type when opening shard 2018-04-25 13:02:09 +01:00
Jeff Wendling 29a62e4f74 Add FieldValidator to allow custom validations on measurements
No appreciable changes in benchmark results. It seems like this
function is less than 4% of cpu time in the write workloads in the
benchmarks at least.
2018-04-23 20:21:27 -06:00
Jeff Wendling d55979450a Fix shard benchmarks
at some point, the Inmem field on the engine options became
required, but the benchmarks weren't updated.

also uses filepath everywhere when manipulating file paths.
2018-04-23 12:39:24 -06:00
Ben Johnson dbbe9d8467
Merge pull request #9615 from influxdata/bj-check-shard-count-on-series-iterator-master
Remove error for series file when no shards exist
2018-04-20 08:14:24 -06:00
Stuart Carnie 14dcc5d6e7 PR feedback 2018-04-19 18:05:55 -07:00
Stuart Carnie e7389b18c0 tsdb: add additional engine options
* filters allow specific combinations of database, retention policy and
  shard groups to be opened. This was added to reduce the start-up time
  of the export tool and limit the memory usage.
2018-04-19 18:05:55 -07:00
Stuart Carnie 7ebfc9c544 add default to avoid blocking 2018-04-12 15:42:33 -07:00
Jacob Marble 10a7ffb647
Check for errors from binary.Uvarint when reading TSI logs (#9705)
* Check for errors from binary.Uvarint when reading TSI logs

* also check len(parsed) == len(input)

* wrap binary.Uvarint

* make uvarint() more generally useful/used
2018-04-12 09:59:56 -07:00
Jonathan A. Sternberg 1f9227e20c Allow math functions to be used in the condition 2018-04-10 10:55:34 -05:00