Commit Graph

1722 Commits (16af32b2f9bb93993239e4cb71b39ba0de241442)

Author SHA1 Message Date
Joe LeGasse 087d9f4670 tsm: fixed test to not require sorted backup tarball 2017-05-11 12:00:19 -04:00
Jason Wilder b150a6293c Merge pull request #8380 from influxdata/jw-wal-buffer
Use buffer writer for wal segments
2017-05-11 08:34:44 -06:00
Jason Wilder b81ac21bcb Merge pull request #8378 from influxdata/jw-snapshot-disable
Don't disable snapshots when snapshot compactions are disabled
2017-05-10 12:00:27 -06:00
Jason Wilder e102fcca9c Use buffer writer for wal segments 2017-05-10 11:42:32 -06:00
Jason Wilder 39a829c1ae Speed up time encoding/decoding
This speeds up time encoding and decoding by skipping the divisor
scaling if scaling by 1.  Since division and multiplication are expensive
cpu and scaling by 1 has no effect, this just slows encoding and decoding
down.
2017-05-10 11:12:35 -06:00
Jason Wilder 4e3e707abc Fix packed time encoded benchmark 2017-05-10 10:35:44 -06:00
Jason Wilder e6f31c38b5 Merge pull request #8372 from influxdata/jw-tombstone-range
Fix deletes triggering unnecessary compactions
2017-05-08 16:52:59 -06:00
Jason Wilder 29c2b1958e Fix deletes triggering unnecessary compactions
Tombstone files would be written to all TSM files even if the deleted
keys or timerange did not exist in the TSM file.  This had the side
effect of causing shards to get recompacted back to the same state. If
any shards or large numbers of TSM files existed, disk usage and CPU
utilization would spike causing issues.

This prevents tombstones being written for TSM files that could not
possiby contain the series keys being deleted or if the delted time
range is outside the range of the file.
2017-05-08 14:52:28 -06:00
Jason Wilder 9374c4f513 Reduce allocations when monitoring shards
When monitoring shards, a slice of measurements is allocated for
each shard.  With many shards and measurements, these allocations
can be large.  Since inmem shards share the same index, we only
need to do this once since the resulting slices are all the same.
This reduces memory usage when monitoring shard cardinality.
2017-05-08 13:34:40 -06:00
Jason Wilder 00bdf62b83 Make shard is ready before returning index type
Shard can be created before they are opened and not have an index
setup yet.  This can cause a panic if IndexType is called.
2017-05-08 12:48:35 -06:00
Jason Wilder 041262af0e Fix race in shard
engine was accessed outside of an RLock which can cause a race when
montitoring goroutines access the shard while it's closed/closing.
2017-05-08 12:37:18 -06:00
Ben Johnson 489c89bea4
Add tsi support tooling. 2017-05-08 11:00:15 -06:00
Jason Wilder c0c6ad6880 Don't disable snapshots when snapshot compactions are disabled
Snapshot compactions can be disabled independently of snapshotting
capability.  This prevents taking backups of shards that have compactions
disabled.
2017-05-05 14:15:45 -06:00
Jason Wilder 73ddd4787b Fix race in SeriesN and CreateSeriesIfNotExists 2017-05-04 14:40:50 -06:00
Jason Wilder fc34d30038 Uses SeriesN instead of copying sketches
Avoids some extra allocations.
2017-05-04 10:12:38 -06:00
Jason Wilder bc639c5982 Make disableLevelCompactions lighter weight
Since this is called more frequently now, the cleanup func was invoked
quite a bit which makes several syscalls per shard.  This should only
be called the first time compactions are disabled.
2017-05-04 09:56:15 -06:00
Jason Wilder 7371f1067b Fix deadlock in Index.ForEachMeasurementTagKey
Index.ForEachMeasurementTagKey held an RLock while call the fn,
if the fn made another call into the index which acquired an RLock
and after another goroutine tried to acquire a Lock, it would deadlock.
2017-05-03 22:48:10 -06:00
Jason Wilder b4ea523910 Include snapshot size in the total cache size
This was causing a shard to appear idle when in fact a snapshot compaction
was running.  If the time was write, the compactions would be disabled and
the snapshot compaction would be aborted.
2017-05-03 16:31:58 -06:00
Jason Wilder 88848a9426 Remove per shard monitor goroutine
The monitor goroutine ran for each shard and updated disk stats
as well as logged cardinality warnings.  This goroutine has been
removed by making the disks stats more lightweight and callable
direclty from Statisics and move the logging to the tsdb.Store.  The
latter allows one goroutine to handle all shards.
2017-05-03 16:31:57 -06:00
Jason Wilder f87fd7c7ed Stop background compaction goroutines when shard is cold
Each shard has a number of goroutines for compacting different levels
of TSM files.  When a shard goes cold and is fully compacted, these
goroutines are still running.

This change will stop background shard goroutines when the shard goes
cold and start them back up if new writes arrive.
2017-05-03 16:31:57 -06:00
Jason Wilder 3d1c0cd981 Don't return compaction plans for files already part of a plan
The compactor prevents the same file from being compacted by different
compaction runs, but it can result in warning errors in the logs that
are confusing.

This adds compaction plan tracking to the planner so that files are
only part of one plan at a given time.
2017-05-03 16:31:57 -06:00
Jason Wilder 8fc9853ed8 Add max-concurrent-compactions limit
This limit allows the number of concurrent level and full compactions
to be throttled.  Snapshot compactions are not affected by this limit
as then need to run continously.

This limit can be used to control how much CPU is consumed by compactions.
The default is to limit to the number of CPU available.
2017-05-03 16:31:57 -06:00
Jason Wilder 80fef4af4a Enable shards after loading
Compactions are enabled as soon as the shard is opened.  This can
slow down startup or cause the system to spike in CPU usage at startup
if many shards need to be compacted.

This now delays compactions until after they are loaded.
2017-05-03 16:31:57 -06:00
Jason Wilder 02e22f4a00 Fix deadlock in Measurement
The lazy sorting of series caused a deadlock since it can not take
a Lock when a caller may have already acquired an RLock.

filters should be called w/o any locks as the function already acquires
locks as needed.
2017-05-03 13:49:56 -06:00
Jason Wilder 3c130cd39c Expose TSMWriter.Flush
Allows flushing the writer so we don't always need to close and
re-open the file handle.
2017-04-28 14:00:50 -06:00
Jason Wilder 141f0d71cd Update index when import files 2017-04-28 14:00:45 -06:00
Jason Wilder a76146e34a Add Store.Import capability
This allows the contents of a backup to be imported into a shard without
requiring the whole shard to be replaced.
2017-04-28 13:30:46 -06:00
Jason Wilder 3839fe34ea Remove FileStore.Add/Remove
Can use Replace which handles files in-use and stats correctly.
2017-04-28 13:20:55 -06:00
Jason Wilder 137d0c0d09 Rename WAL.WritePoints to WAL.WriteMulti
To match Cache.WriteMulti
2017-04-28 13:20:55 -06:00
Jason Wilder 28422f2fec Use consistent receiver var name for Value types 2017-04-28 13:20:55 -06:00
Jason Wilder 1bc4936336 Export Reader.ReadBytes 2017-04-28 13:20:55 -06:00
Stuart Carnie b2d2976466 update reason messages 2017-04-28 11:21:57 -07:00
Stuart Carnie 8097e817f6 prefix partial write errors with `partial write:`
NOTE: parser errors (via http API) are also transformed into
PartialWriteError
2017-04-28 11:00:14 -07:00
Ben Johnson aa64c908d0 Merge pull request #8314 from benbjohnson/tsi-doc
Add TSI documentation
2017-04-24 10:58:31 -06:00
Ben Johnson ba7108f94e
Add TSI documentation. 2017-04-21 14:45:03 -06:00
Jason Wilder d88604f6f2 Move repetive loop checks outside of values loop 2017-04-20 13:45:04 -06:00
Jason Wilder 888689f5d3 Move values loop under type switch
All the values read must be of the same type so repeatedly using
the type switch is confusing and less efficiient.
2017-04-20 13:39:49 -06:00
Jason Wilder b0988511bf Use fixed size array instead of slice 2017-04-20 13:38:33 -06:00
Jason Wilder da6bdfdda8 Use bufio.Reader when reading wal segments
Reduces disk IO due to small reads.
2017-04-20 13:33:42 -06:00
Jason Wilder 8e9cbd7ffc Simplify WALSegmentReader.UnmarshalBinary
There were two loops over nvals which created some extra allocation
which coudl be replaced with a simplet slice capacity and append.
2017-04-20 13:33:42 -06:00
Jason Wilder 02b663b651 Fix lock contention in Index.CreateSeriesListIfNotExists
There was contention on the write lock which only needs to be acquired
when checking to see if the log file should be rolled over.
2017-04-20 12:28:42 -06:00
Jason Wilder 40ec85aacd Fix lock contention in LogFile.SeriesWithBuffer
Under high write load, the check for each series was done sequentially
which caused a lot of CPU time to acquire/release the RLock on LogFile.

This switches the code to check multiple series at once under an RLock
similar to the chang for inmem.
2017-04-20 12:28:42 -06:00
Jason Wilder 0e715b5b74 Reduce lock contention on MeasurementFields 2017-04-20 12:28:42 -06:00
Jason Wilder ef65ee77f4 Switch WAL byte pools to sync/pool
The current bytes.Pool will hold onto byte slices indefinitely. Large
writes can cause the pool to hold onto very large buffers over time.
Testing w/ sync/pool seems to perform similarly now so using a sync/pool
will allow these buffers to be GC'd when necessary.
2017-04-20 12:28:42 -06:00
Jason Wilder d155d37ca8 Reduce TSM write buffer
When many TSM files are being compacted, the buffers can add up fairly
quickly.
2017-04-20 12:28:42 -06:00
Jason Wilder 3c2825a851 Reduce lock thrashing when checking series
The inmem index would call CreateSeriesIfNotExist for each series
which takes and releases and RLock to see if a series exists. Under
high write load, the lock shows up in profiles quite a bit.  This
adds a filtering step that obtains a single RLock and checks all the
series and returns the non-existent series to contine though the slow
path.
2017-04-20 12:28:41 -06:00
Jason Wilder d7c5dd0a3e Reduce wal sync goroutine churn
Under high write load, the sync goroutine would startup, and end
very frequently.  Starting a new goroutine so frequently adds a small
amount of latency which causes writes to take long and sometimes timeout.

This changes the goroutine to loop until there are no more waiters which
reduce the churn and latency.
2017-04-20 12:28:34 -06:00
Jason Wilder aa9925621b Fix deadlock in wal
If the sync waiters channel was full, it would block sending to the
channel while holding a the wal write lock.  The sync goroutine would
then be stuck acquiring the write lock and could not drain the channel.

This increases the buffer to 1024 which would require a very high write
load to fill as well as retuns and error if the channel is full to prevent
the blocking.
2017-04-19 11:33:13 -06:00
Jason Wilder a19ce9c10f Reduce index lock contention
Series and Measurment have their own locks and we do not need to
hold locks on the index while using those types.
2017-04-18 16:32:33 -06:00
Jason Wilder 883b3dcbbb Reduce lock content in AssignShard
The lock shows up under write load.  It only needs to be assigned
once so a read lock eliminates the contention.
2017-04-18 16:32:33 -06:00
Jason Wilder 5c51ae7319 Merge branch '1.2' into jw-merge-123 2017-04-14 14:36:54 -06:00
Jason Wilder ff1270dfeb Fix dropping fields created data corruption
The Point is intended to be immutable after being parsed since it
is shared by several goroutines.  When dropping a field (e.g. time),
corrupted data can result if one goroutine is delete the field
while another is marshaling the underlying byte slices.

To avoid this, the shard will just skip invalid fields and series
instead of trying to mutate them by deleting them.
2017-04-07 12:58:42 -06:00
Jason Wilder 1de99cd219 Merge pull request #8268 from influxdata/jw-dedup-measurements
Ensure MeasurementNames deduplicates measurements across shards
2017-04-06 13:10:56 -06:00
Jason Wilder 927acb5ab9 Ensure MeasurementNames deduplicates measurements across shards 2017-04-06 12:17:29 -06:00
Jason Wilder cf100647e0 Fix deadlock in Measurement.SeriesIDsAllOrByExpr
SeriesIDsAllOrByExpr took a RLock and ended up calling SeriesIDs
which can take a Lock causing a deadlock.
2017-04-05 16:22:45 -06:00
Ben Johnson 9c97cd8601
Merge remote-tracking branch 'upstream/master' into tsi 2017-04-04 12:46:09 -06:00
Ben Johnson 0d74497abe
Reset rhh map elements to reuse allocations. 2017-04-04 11:57:37 -06:00
Ben Johnson 6ff27c95e5
Fix tsi assertions. 2017-04-04 11:29:21 -06:00
Ben Johnson dbc10559c4 Merge pull request #8247 from benbjohnson/tsi-series-block-partitioning
TSI Series Block Partitioning
2017-04-04 11:15:10 -06:00
Jason Wilder 5fa8073fc2 Merge branch '1.2' into jw-merge-123 2017-04-04 11:12:06 -06:00
Jason Wilder 84cbee227a Fix file store not close all TSM files
Regression added via #8192
2017-04-04 10:58:51 -06:00
Ben Johnson 95d4016ff2
Merge branch 'tsi' of https://github.com/influxdata/influxdb into tsi-series-block-partitioning 2017-04-04 10:14:03 -06:00
Jason Wilder ec7eea2a0f Skip tests on appveyor that we skip w/ -race 2017-04-04 09:47:59 -06:00
Ben Johnson bf49b176f5
Partition tsi1 series index. 2017-04-04 09:46:04 -06:00
Jason Wilder 793635dbd7 Skip TSI cardinality tests on appveyor 2017-04-04 09:19:43 -06:00
Jason Wilder 4f850b5cff Skip TestCache_Deduplicate_Concurrent on windows 2017-04-04 08:48:55 -06:00
Jason Wilder 7ac3c9a26f Remove unused cardinality func 2017-04-03 11:24:55 -06:00
Jason Wilder fcdc3c5c21 Remove commented out code in meta 2017-04-03 11:22:59 -06:00
Jason Wilder 8da84e6144 Merge branch 'master' into tsi 2017-04-03 11:21:02 -06:00
Jason Wilder 68f73e64d1 Lazily sort Measurement.SeriesIDs
Removing series while trying to maintain the sorted series list
does not perform well when removing many series.  This causes
drop DB, RP, series, to be very slow in some cases.

Instead, lazily create a sorted series list when first requested and
invalidate it when dropping series.
2017-04-03 08:57:53 -06:00
Jason Wilder 32c4d43952 Speed up drop measurement
This reworks drop measurement to use a sorted list of series keys
instead of creating an intermediate map.  It remove allocations
and some extra garbage that is created during drop measurement.
2017-04-03 08:57:53 -06:00
Jason Wilder a78da51b7c Use buffered writer when writing tombstones
When deleting many series, the many small writes flood the disks
and consume a lot of CPU time.
2017-04-03 08:57:52 -06:00
Jason Wilder 6232d5e56d Remove defer allocations in TSMReader 2017-04-03 08:57:52 -06:00
Jason Wilder 920c8396c6 Use sorted merge in FileStore.WalkKeys
WalkKeys serially walked each TSM file and invoked fn for each key.
Caller needed to handle duplicate calls to fn with the same key
because the same key could exist in multiple TSM files.  The serial
execution was also slower.

Since the series keys are already sorted, we can iterate over all
files in parallel and skip duplicates using a sorted merge.  This
fixes the duplicate invocation issue as well as speeds up walking
all keys.

This can significant improve startup performance when many TSM files
exists that may not have been fully compacted.  This also has benefits
for deletes (measurements/series) since duplicates are removed saving
extra allocations and work.  This may also allow for the optimize
compaction to be removed provided startup times are fast enough.
2017-04-03 08:57:52 -06:00
Edd Robinson 5e342a2ddd Ensure shared index removed on database drop
When using the inmem index, if one drops a database, and then creates it
again, the previous index object will be reused. This includes the
previous cardinality estimation sketches, leading to inaccurate
cardinality estimations.
2017-03-30 13:05:31 +01:00
Edd Robinson ddf7f0fd7b Remove uncalled method 2017-03-30 12:48:22 +01:00
Edd Robinson fddaff2cc8 Merge master in 2017-03-29 18:00:28 +01:00
Edd Robinson 116230b427 Use varint for tag count 2017-03-29 16:31:13 +01:00
Edd Robinson 45f843fc91 Don't unassign shards when system shutting down 2017-03-29 11:57:38 +01:00
Ben Johnson 2edfb1c92d
Ignore series limit on database load. 2017-03-24 16:27:16 -06:00
Jason Wilder ee03fbb164 Fix series tombstone sketch not updated when dropping measurment 2017-03-24 15:49:00 -06:00
Ben Johnson d2b396bff5
Fix database series limit, remove shard series limit. 2017-03-24 13:16:00 -06:00
Ben Johnson 9fb8f1ec1d
Fix database and tag limits. 2017-03-24 09:48:10 -06:00
Jason Wilder 631681796d Remove tsl file committed by mistake 2017-03-23 16:18:27 -06:00
Jason Wilder 7119ef8f29 Merge pull request #8193 from influxdata/jw-123-backports
1.2.3 backports
2017-03-23 13:31:35 -06:00
Jason Wilder ca1919e5de Use standard merge algorithm for merging values
The previous version was very innefficient due to the benchmarks used
to optimize it having a bug.  This version always allocates a new
slice, but is O(n).
2017-03-23 12:53:59 -06:00
Jason Wilder ba2571903d Fix broken Values.Merge benchmark
Merge had the side effect of modifying the original values so
the results are wrong because they always hit the fast path
after the first run.
2017-03-23 12:53:50 -06:00
Jason Wilder 890ffb4ce8 Generate encode*Values funcs 2017-03-23 12:53:29 -06:00
Jason Wilder ced953ae89 Use typed values to avoid allocations
This switches compactions to use type values (FloatValues) from the
generic Values type.  It avoids a bunch of allocations where each value
much be converted from a specific type to an interface{}.
2017-03-23 12:53:17 -06:00
Jason Wilder a1c84ae6f3 Add block type for BlockIterator 2017-03-23 12:49:17 -06:00
Jason Wilder 2972a3f223 Remove MMAP derefencing code
This code was added to address some slow startup issues.  It is believed
to be the cause of some segfault panic's that occur at query time when
the underlying MMAP array has been unmapped.  The current structure of
code makes this change unnecessary now.
2017-03-23 12:46:23 -06:00
Jason Wilder 61f80db1b9 Skip cardinaltiy dups on circle race test 2017-03-22 15:20:38 -06:00
Jason Wilder c443e639b0 Fix 32bit alignment issue in wal.sync 2017-03-22 11:21:29 -06:00
Jason Wilder 06306bbd97 Run store tests in parallel 2017-03-22 10:55:38 -06:00
Edd Robinson 1c4ecb12c1 Don't panic on nil engine 2017-03-22 10:07:29 -06:00
Ben Johnson 85c1ae4dd4
Remove sort.Slice 2017-03-21 12:33:05 -06:00
Ben Johnson afe41f1c80
Fix tsm1/tsi1 broken tests. 2017-03-21 12:21:48 -06:00
Ben Johnson 1e9fa7bc2c
Fix 32-bit rhh implementation. 2017-03-21 11:44:13 -06:00
Jason Wilder 58c8736ebc Merge pull request #8172 from influxdata/jw-dropped-points
Fix series not getting created
2017-03-21 09:44:31 -06:00
Jason Wilder 92c722913d Unlock index if dropping non-existent series 2017-03-21 09:19:44 -06:00