Commit Graph

2639 Commits (409de34abfa95f34d48d62ddd1adc0e5cea9ebc9)

Author SHA1 Message Date
Edd Robinson 81f640e9ae Add more methods and benchmarks to SeriesIDSet 2018-09-18 15:58:38 -07:00
Edd Robinson 9fb301cf10 Add CreateSeriesListIfNotExists benchmark 2018-09-18 15:58:38 -07:00
Edd Robinson 2c4c79f110 Convert cache to LRU 2018-09-18 15:58:38 -07:00
Edd Robinson 2ae2157d02 debug 2018-09-18 15:58:38 -07:00
Edd Robinson 74b3d35e40 Basic cache 2018-09-18 15:58:38 -07:00
Edd Robinson 7d00a45ebf Don't allocate when reading tombstone SeriesID set 2018-09-18 15:58:38 -07:00
Edd Robinson 722ca22c79 Switch to influxdata fork 2018-09-18 15:58:38 -07:00
Edd Robinson ca07a38402 Add benchmark for TagValueSeriesIDIterator 2018-09-18 15:53:52 -07:00
linxGnu 1a236cf629 Update test case 2018-09-14 14:09:24 -07:00
linxGnu 1dde9a1e12 Update test case 2018-09-14 14:09:24 -07:00
linxGnu 6f10f54fd0 Update test case and documentation 2018-09-14 14:09:24 -07:00
linxGnu 2356a30833 Fix bug on array values in tsdb storage engine 2018-09-14 14:09:24 -07:00
Ben Johnson f67bbe76b5
Merge pull request #10278 from influxdata/hll-memory
Remove TSI1 HLL sketches from heap.
2018-09-12 14:46:25 -06:00
Ben Johnson 88d006a18c
Remove TSI1 HLL sketches from heap.
This commit removes the HLL sketches on each `tsi1.LogFile` and
`tsi1.IndexFile` and instead caches the data at the `tsi1.Index`
level. This reduces the heap size significantly for servers with
many TSI-enabled shards.
2018-09-12 08:48:40 -06:00
Stuart Carnie a940ebd45a fix(tsm1): Fix FloatBatchDecodeAll to return empty slice an no error
FloatBatchDecodeAll behaves the same as the iterator-based float
decoder, returning an empty slice and no error when passed a buffer
with no encoded float values.

Fixes #10270
2018-09-10 13:59:47 -07:00
Stuart Carnie 4e91c8d33d Revert: Unmap LogFile on successful open
Resolves a panic when attempting to sort the `logMeasurements` slice,
which holds on to mmap'd data.
2018-09-04 15:16:09 -06:00
Hans Petter Bieker de3a2d657d Fixed indentation. 2018-08-31 11:01:45 +02:00
Hans Petter Bieker 28f5fb4ea5 Prevent rebuilding of series files for shards where nothing is deleted. 2018-08-31 10:51:38 +02:00
Jeff Wendling 4e62c3f795 fix(tsm1): return boolean array iterator for booleans
booleans are still not strings.
2018-08-27 11:32:15 -06:00
Stuart Carnie 2f4fcd8255 chore: Remove BatchCursor references 2018-08-24 11:56:04 -07:00
Edd Robinson 74185d29e6
Merge pull request #10226 from influxdata/er-tsl-unmap
Unmap LogFile on successful open
2018-08-24 12:12:14 +01:00
David Norton 05d979d6b1
Merge pull request #10215 from influxdata/dn-snappy-digests
Switch digests to use snappy compression
2018-08-23 13:17:28 -04:00
David Norton 2f6a1fc03b switch digests to use snappy compression 2018-08-23 13:02:12 -04:00
Edd Robinson 9970620ee0 Unmap LogFile on successful open
Since we append to the file itself, once we have read the file in, we
can be done with the mmap'd data.

Ideally we can rework UnmarshalBinary and do away with the mmap
completely. That is future work.
2018-08-23 17:24:22 +01:00
Stuart Carnie e685556c81 fix(tsm1): Fix panic when calling Close twice on a descending cursor. 2018-08-22 13:49:59 -07:00
Jeff Wendling 6150bc1eea
Merge pull request #10217 from influxdata/jmw-cursor-iterator-fix
fix(tsm1): return boolean iterator for booleans
2018-08-21 14:31:38 -06:00
Jeff Wendling d258361fb4 fix(tsm1): return boolean iterator for booleans 2018-08-21 13:51:35 -06:00
Edd Robinson f52de2d1e7 Ensure orphaned series removed from inmem index
This commit ensures that any orphaned series (series that are to be
removed and no longer are referenced anywhere in the database) are
removed from the `inmem` index when a shard is dropped.
2018-08-21 15:00:35 +01:00
Edd Robinson dece5b847f Refactor index names 2018-08-21 14:32:30 +01:00
Edd Robinson a67f15fad4 Promote DropSeriesGlobal to Index interface 2018-08-20 17:57:16 +01:00
Edd Robinson 035b26cadd Refactor DropSeriesGlobal 2018-08-20 16:37:55 +01:00
Ben Johnson 2d266ca186
Merge pull request #9801 from influxdata/bj-validate-write
Add option for unicode validation.
2018-08-20 03:44:41 -10:00
Edd Robinson 6b3860e9a1 Reduce allocations in TSI TagSets implementation
Since all tag sets are materialised to strings before this method
returns, a large number of allocations can be avoided by carefully
resuing buffers and containers.

This commit reduces allocations by about 75%, which can be very
significant for high cardinality workloads.

The benchmark results shown below are for a benchmark that asks for all
series keys matching `tag5=value0'.

name                                               old time/op    new time/op    delta
Index_ConcurrentWriteQuery/inmem/queries_100000-8     5.66s ± 4%     5.70s ± 5%     ~     (p=0.739 n=10+10)
Index_ConcurrentWriteQuery/tsi1/queries_100000-8      26.5s ± 8%     26.8s ±12%     ~     (p=0.579 n=10+10)
IndexSet_TagSets/1M_series/inmem-8                   11.9ms ±18%    10.4ms ± 2%  -12.81%  (p=0.000 n=10+10)
IndexSet_TagSets/1M_series/tsi1-8                    23.4ms ± 5%    18.9ms ± 1%  -19.07%  (p=0.000 n=10+9)

name                                               old alloc/op   new alloc/op   delta
Index_ConcurrentWriteQuery/inmem/queries_100000-8    2.50GB ± 0%    2.50GB ± 0%     ~     (p=0.315 n=10+10)
Index_ConcurrentWriteQuery/tsi1/queries_100000-8     32.6GB ± 0%    32.6GB ± 0%     ~     (p=0.247 n=10+10)
IndexSet_TagSets/1M_series/inmem-8                   3.56MB ± 0%    3.56MB ± 0%     ~     (all equal)
IndexSet_TagSets/1M_series/tsi1-8                    12.7MB ± 0%     5.2MB ± 0%  -59.02%  (p=0.000 n=10+10)

name                                               old allocs/op  new allocs/op  delta
Index_ConcurrentWriteQuery/inmem/queries_100000-8     24.0M ± 0%     24.0M ± 0%     ~     (p=0.353 n=10+10)
Index_ConcurrentWriteQuery/tsi1/queries_100000-8      96.6M ± 0%     96.7M ± 0%     ~     (p=0.579 n=10+10)
IndexSet_TagSets/1M_series/inmem-8                     51.0 ± 0%      51.0 ± 0%     ~     (all equal)
IndexSet_TagSets/1M_series/tsi1-8                     80.4k ± 0%     20.4k ± 0%  -74.65%  (p=0.000 n=10+10)
2018-08-10 16:01:49 +01:00
Edd Robinson 9f883c8dee Add benchmark for TagSets across indexes 2018-08-10 16:01:49 +01:00
Stuart Carnie 12f7f45707 feat(tsdb): Add CursorType to enable selection of batch cursors 2018-08-10 06:39:14 -07:00
Jacob Marble f1fc1b0264
Merge pull request #10175 from influxdata/jgm-copy-byte-slices
tsdb: Copy return value of IndexSet.MeasurementNamesByExpr
2018-08-09 11:20:45 -07:00
Stuart Carnie 990824ceca fix(tsdb): Fix panic, don't add nil iterator to slice
fixes #10171
2018-08-09 10:12:49 -07:00
Jacob Marble 7bd9b2a627 tsdb: Copy return value of IndexSet.MeasurementNamesByExpr 2018-08-08 23:48:06 -07:00
Jonathan A. Sternberg ebd77d1b3d
Merge pull request #10170 from influxdata/js-create-series-cursor-panic
Prevent a panic from occuring when CreateSeriesCursor fails
2018-08-08 08:19:40 -05:00
Jonathan A. Sternberg fe996612eb Prevent a panic from occuring when CreateSeriesCursor fails
The internals of `newSeriesCursor` returned a struct pointer that
implicitly got turned into the interface. Unfortunately, Go treats this
type of interface conversion as a nil pointer to the struct rather than
as just nil so if you attempted to compare the returned cursor to nil,
they would not be equal and it would think it was non-nil and attempt to
use the cursor.
2018-08-07 22:55:02 -05:00
Jacob Marble 786d637780 tsdb: Cleanup compaction throughput code 2018-08-07 11:12:41 -07:00
Zach Goldstein 0ef3752a1a Add configuration parameter to expose rate limit for TSM compaction.
Closes: 9938
2018-08-07 10:05:36 -04:00
Edd Robinson 3bcb8ad9b2
Merge pull request #10161 from influxdata/er-tidy
Simplify loops
2018-08-06 15:24:49 +01:00
Edd Robinson 9eece563b1 Simplify loops 2018-08-05 15:16:33 +01:00
David Norton 50bbf11299 add digest manifest 2018-08-03 15:17:08 -04:00
Edd Robinson 996bb9bfa6 Wire in mmap advise hint to TSMReader 2018-08-03 16:27:39 +01:00
Edd Robinson 282d265dd4 Add mmap madvice kernel value config option
This PR adds a configuration option that can be used to inform the
kernel that we intent to page in much of the TSM files.

This madvise value has been problematic in the past when its been set,
so this option defaults to off. It may be useful to some users with slow
disks.
2018-08-03 14:07:46 +01:00
Edd Robinson 19a4f1c9b0 Fix megacheck 2018-07-31 15:22:54 +01:00
Edd Robinson 7662249fb9 Revert to RoaringBitmap org 2018-07-31 15:17:03 +01:00
Edd Robinson 61af08abde Fix megacheck 2018-07-31 15:03:54 +01:00
Ben Johnson 5612511a8f
Use roaring.Bitmap.FromBuffer(), remove memory alignment. 2018-07-30 13:42:13 +00:00
Ben Johnson 66920a181a
Add legacy tsi1 uvarint encoding test. 2018-07-27 15:43:14 +01:00
Ben Johnson 80d01325f8
Refactor file set tag value iterators to support series sets & tombstones. 2018-07-26 23:48:27 +01:00
Ben Johnson cb828f0187
Fix roaring dependency, minor PR fixes. 2018-07-26 09:32:43 +01:00
Ben Johnson fdfd038401
Add roaring bitmaps to TSI index files. 2018-07-24 17:59:23 +01:00
Jeff Wendling 63fbf53699
Merge pull request #10063 from influxdata/jmw-extra-log-context
Make store include context in logs
2018-07-18 11:53:22 -06:00
Edd Robinson 95db829631 Remove default max concurrent compaction limit
PR #9204 introduced a maximum default concurrent compaction limit of 4.
The idea was to reduce IO utilisation on large systems with many cores,
and high write load. Often on these systems, disks were not scaled
appropriately to to the write volume, and while the write path could
keep up, compactions would saturate disks.

In #9225 work was done to reduce IO saturation by limiting the
compaction throughput. To some extent, both #9204 and #9225 work towards
solving the same problem.

We have recently begun to notice larger clusters to suffer from
situations where compactions are not keeping up because they have been
scaled up, but the limit of 4 has stayed in place. While users can
manually override the setting, it seems more user friendly if we remove
the limit by default, and set it manually in cases where compactions are
causing too much IO on large boxes.
2018-07-18 17:27:49 +01:00
Edd Robinson 55ffeb563a Tidy up logging of compaction settings 2018-07-18 17:26:34 +01:00
Jeff Wendling 7bdbe26534 Make store include context in logs
If some error or message is in the context of some shard or database
be sure to include it in the message.
2018-07-18 10:22:53 -06:00
Edd Robinson 80dc07cbcb Efficient means of getting fields for measurement
If it's known that the read request only needs to use a single
measurement, then we can avoid the need to get field keys via the query
engine.

However, that means that a new method of getting the field keys for a
measurement would be needed. This commit exposes a method to efficiently
get field key names for a measurement across multiple shards.

name
2018-07-18 12:21:54 +01:00
Edd Robinson 9c5c1c7001 Optimisation for expressions with single measument 2018-07-18 12:21:54 +01:00
Jeff Wendling f5ed934646
Merge pull request #10089 from influxdata/jmw-radix-sort
inmem: use radix sort for series ids
2018-07-17 17:45:41 -06:00
Jeff Wendling d979518135 inmem: use radix sort for series ids 2018-07-17 12:31:12 -06:00
Ben Johnson b05e83e8ef
Merge pull request #10021 from huhue/sfile_fix
bug fix from seriesfile enable EnableCompactions function
2018-07-17 15:42:00 +01:00
David Norton 6016a80997 allow tag keys to contain underscores 2018-07-17 09:39:08 -04:00
Stuart Carnie d977c0ac24 fix(tsdb): Fix existing Prometheus tests based on batch cursors 2018-07-16 08:55:37 -07:00
Stuart Carnie 497fc42779 pr(tsdb): Feedback items from megacheck
* batch cursors and cursorIterator will be removed in a follow up
  PR using Arrow array data structures
2018-07-16 08:55:37 -07:00
Stuart Carnie 910d0fe5e6 feat(tsm1): ArrayCursor interfaces and implementations
Array cursors are enabled for storage RPC calls

tsm1:

* Implemented cursors that utilize Array decoders

storage:

* Abstractions to easily switch to Array cursors
2018-07-16 08:55:37 -07:00
Stuart Carnie 3632df77a6 feat(tsm1): Add Read<type>ArrayBlock APIs to FileStore
* introduced tmpl from Arrow, which allows existing templates to be
  reused with additional command-line properties to control output.
* duplicated suite of ReadFloatBlock tests for ReadFloatArrayBlock
    * only the float data type is tested as the Read APIs are generated
      from a single template.
2018-07-16 08:55:37 -07:00
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 9c29cd69e5 feat(tsm1): Provide columnar value types
* separate slices for time and values
* structured to be Arrow ready
* batch decoders fill time and value slices independently that
  vastly improves performance (benchmarks linked in PR)
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
Jacob Marble ffe54d0239 Revert "Resolve deadlock"
This reverts commit 681f22b078.
2018-07-09 22:05:54 -07:00
Edd Robinson ad388a8fd8 Address PR feedback 2018-07-09 11:51:48 +01:00
Edd Robinson 11bea138f8 Restrict buffer size 2018-07-09 11:51:48 +01:00
Edd Robinson 96ed566e6c Store series ID sets in LogFile as bitmaps
This commit swaps out map[uint64]struct{} implementations for roaring
bitmaps, which in turn improves memory usage and read performance.

The bitmap implementation is abstracted such that for low cardinality
sets a simple slice of ids is used, to reduce in-use memory.
2018-07-09 11:51:48 +01:00
Edd Robinson 13f896b9ff Buffer writing of .tsl file with 128K buffer 2018-07-09 11:51:48 +01:00
Edd Robinson 3cf20823e9 Allow LogFile buffer size to be changed
When adding many series using offline tooling, it's likely that every
series involves an entry being appended to a LogFile. Typically an entry
is 11 or 12 bytes, but the default bufio.Writer buffer size is only 4K.

This means by default a write of 10,000 new series would involve ~30
buffer flushes.

This commit makes the buffer configurable, and sets the value in
`buildtsi` such that it reflects the number of series being written to
the LogFile.
2018-07-09 11:51:48 +01:00
Edd Robinson 681af04815 Optionally disable buffer flushing/file syncing
When running offline tooling, flushing buffers and syncing files on
every write to a `LogFile` is not necessary. Were a hard exit
with data loss to occur, the tooling can simply be run again.
2018-07-09 11:51:15 +01:00
Jacob Marble b7d5e2ecdf
Merge pull request #10050 from influxdata/jgm-delete-regex
Resolve deadlock deleting from many measurements concurrently
2018-07-08 17:01:33 -07:00
Jacob Marble 681f22b078 Resolve deadlock
TSI LogFile compactions occasionally race with insert and delete
operations because the index partition FileSet is retained needlessly by
the method that calls Partition.CheckLogFile.

In this change:
- TSI LogFile compaction respects enable/disable compactions
- Partition FileSet.Release before log compaction is triggered

An alternative to the second step is to handle log file compaction in a
new goroutine. Log file compaction errors would be logged and not
returned to the caller.

After this change, `DELETE FROM /regex/` does not deadlock; performance:
- 30s to delete 100 measurements
- 5m30s to delete 1000 measurements
2018-07-06 15:02:38 -07:00
Jacob Marble 2ac811e57e close objects without swallowing errors 2018-07-06 13:45:22 -07:00
Jacob Marble 0af22b5992 Partition receiver rename
Got tired of referring to Index Partitions as `i` instead of `p`.
2018-07-05 14:28:00 -07:00
Jacob Marble dcb85d2e92 Init TSI partition logger
TSI Partition logging was never initialized because WithLogger was
called after Open; Open initializes Partition loggers.
2018-07-05 14:27:09 -07:00
Ben Johnson 979d790154
Implement bitset iterator 2018-07-05 09:01:22 -06:00
Edd Robinson 6059db3d3a Filter series IDs at the last possible moment 2018-07-02 16:48:40 +01:00
Edd Robinson 609b980671 Don't filter at low-level 2018-07-02 16:47:44 +01:00
Edd Robinson 0060b83644 create iterator benchmark 2018-07-02 16:47:44 +01:00
chenjian.cj 983a92323f fix. 2018-07-01 19:57:16 +08:00
Ben Johnson 7727a4a67f
Merge pull request #9977 from influxdata/bj-show-tag-values-value-filtering
Allow value filtering on SHOW TAG VALUES
2018-06-28 10:25:19 -06:00
Ben Johnson 8be85c154a
Allow value filtering on SHOW TAG VALUES
This commit allows users to filter on the `value` field in the
`SHOW TAG VALUES` command:

	SHOW TAG VALUES WITH KEY = "mytag" WHERE "value" = 'myvalue'

Previously this command would return all values.
2018-06-28 09:50:03 -06:00
Ben Johnson edcb391022
Improve series segment recovery. 2018-06-26 10:56:44 -06: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
David Norton d61c4a43b0
Merge pull request #9986 from influxdata/dn-add-digest-logging
add digest logging
2018-06-21 11:56:21 -04:00
michaelyou 88ccbe43b3 Some typo and Wrong position of comment 2018-06-21 10:46:10 +08:00
Ben Johnson ccadb3799c
Merge pull request #9982 from influxdata/bj-tsi-wal-flush-sync
Flush/sync TSI1 WAL
2018-06-20 15:34:15 -06:00
Ben Johnson fd5a2116d7
Flush/sync TSI1 WAL 2018-06-19 08:32:33 -06:00
Tanya Gordeeva cff3a1120e Fix flaky test TestStore_BackupRestoreShard
Iterator could be left open.

Fixes #9965
2018-06-18 09:45:26 -07:00
David Norton aa61f5016e
Merge pull request #9970 from influxdata/dn-show-tag-keys-perf
fix SHOW TAG KEYS perfomance regression
2018-06-15 17:35:06 -04:00
David Norton b4fd65baf1 add digest logging 2018-06-15 16:55:59 -04:00
David Norton 57f97a72e6 fix SHOW TAG KEYS perfomance regression 2018-06-15 11:26:43 -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
Stuart Carnie 88cd9f3fcf pr(influx-tools): Improvements per PR review 2018-06-13 10:29:59 -07:00
Stuart Carnie 7e998779e6 feat(tsdb/store): Option to disable compactions for offline tools
Allows an offline tool to open the tsdb.Store with compactions disabled.
2018-06-13 10:29:59 -07:00
Stuart Carnie 7abf3ec048 fix(tsdb/store): Fix hang when closing Store if monitor is disabled 2018-06-13 10:29:59 -07:00
Edd Robinson 28b6df7afb Ensure remote read can handle no data in time 2018-06-12 23:10:18 +01:00
michaelyou 7c417818f4 Hash ring's hash mod 2018-06-07 12:03:01 +08:00
Ben Johnson cfaaf39d8b
Export Shard.Engine() 2018-06-04 13:25:03 -06: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 9c4073ce75 tests: Fix OpenLimiter is nil 2018-06-01 11:20:44 -07: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
Stuart Carnie e209a0a1f2 Restore "Performance optimization suggestions"
CLA confirmed
PR: https://github.com/influxdata/influxdb/pull/9836

This reverts commit 7215bad
2018-05-23 08:54:20 -07: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
Stuart Carnie 7215badfcd Revert "Performance optimization suggestions"
This reverts commit f82d53f75d.
2018-05-21 14:10:03 -07:00
chenjian.cj f82d53f75d Performance optimization suggestions 2018-05-21 13:30:32 -07: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
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
Ben Johnson 58aed93fe6
Add option for unicode validation. 2018-05-02 11:16:55 -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
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
Ben Johnson 92d38414f2
Add adjustable TSI log file size.
This commit adds the `max-index-log-file-size` configuration flag so
that users can restrict the maximum size of log files before compaction.
The default limit was also lowered from `5MB` to `1MB`. The original
size was set before we partitioned the index so the change reflects this.
2018-04-02 11:47:59 -06: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
Stuart Carnie 2cc1f5137e support for tenant+bucket
NOTE: to match storage service, values for database and rp are
hard-coded to `db` and `rp` respectively
2018-03-23 12:26:55 -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