Commit Graph

591 Commits (1f75ca2df1a1701bbd398392cf7b282ac7cf549f)

Author SHA1 Message Date
Jason Wilder 56d85d44ad Use RemoveAll instead of Remove
When a database is dropped, removing old segments returns an error
because the files are already gone.  Using RemoveAll handles this
case more gracefully.
2015-10-26 13:16:32 -06:00
Jason Wilder 8af066b8ee Add more context to errors when flushes fail 2015-10-26 13:08:06 -06:00
Jason Wilder 801e766a00 Remove database from meta store before delete local files
Prevents a race where shards are recreated after a database is dropped.
2015-10-26 13:06:06 -06:00
Jason Wilder 9046244df3 Remove the shard references when database is dropped
The shards map still held a reference to a shard that was dropped
which caused the periodic mainteance task to report errors continuously.
2015-10-26 13:04:57 -06:00
Jason Wilder 4d277e7772 Ensure WAL is closed when closing engine
If a database is dropped, the WAL maintenance goroutines could still
kick in an fail becase the DB dirs are gone.
2015-10-26 10:38:52 -06:00
Jason Wilder 6240972121 Log errors returned from failed compactions 2015-10-26 10:37:09 -06:00
Jason Wilder 562ccb6492 Add missing cacheLock/writeLock.Unlock calls
If an error occurred in this code path, the locks would not be released.
2015-10-26 10:17:47 -06:00
Jason Wilder 4afb98ba8b Return error instead of panicing if we can't create a new WAL segment
If a drop database is executed while writes are in flight, a panic
could occur because the WAL would fail to write to the DB dirs where
had been removed.

Partil fix for #4538
2015-10-26 09:53:47 -06:00
Philip O'Toole 96334108e2 Merge pull request #4557 from influxdb/ci_test_enhancements
Run 1 container of tests with tsm1
2015-10-23 14:10:52 -06:00
Philip O'Toole f43c759e7c Log engine selection via environment variable 2015-10-23 13:58:06 -06:00
Ben Johnson 6413e87030 revert default engine to bz1 2015-10-23 13:31:30 -06:00
Ben Johnson e9d303531e reuse tsm1 decode buffer
This commit changes `tsm1.DecodeBlock()` to reuse the same
slice of `[]tsm1.Value` instead of reallocating a new one each time.
2015-10-23 12:51:55 -06:00
Jason Wilder 7beb4f7fec Remove Stat+Remove before Rename calls
The Stat+Remove calls are unnecessary because Rename will replace
the destination file if it exist or not.  There is no need to remove
the destination file before calling Rename.
2015-10-23 12:18:49 -06:00
Jason Wilder 61cbb5b6ff Use RemoveAll instead of Remove
Several places use os.Remove and check for os.ErrNotExist.  os.Remove
does not return os.ErrNotExit, it returns a *PathError so these remove
calls will panic if the file does not exist.

Instead use os.RemoveAll that will not return an error if the file does
not exist.

Fixes #4545
2015-10-23 12:06:20 -06:00
Jason Wilder 827c51384c Merge pull request #4543 from influxdb/jw-wal-tests
Fix WAL Write/Close concurrency issues
2015-10-22 10:23:46 -06:00
Jason Wilder 8dec255b15 Move closing check for flush before cacheLock
Lock does not need to be acquired.
2015-10-22 10:12:07 -06:00
Ben Johnson 28b585e639 refactor tsdb query engine
This commit refactors the tsdb query engine to use separate aggregate
and raw execution paths, encapsulates cursor functionality, and removes
the TagSetCursor from the aggregate path. By removing the TagSetCursor,
we can pass sets of unordered values to the map functions and bypass
the `container/heap` entirely.
2015-10-22 09:41:12 -06:00
Paul Dix 529985964f Ensure compactions don't create files much larger than 2GB.
* refactor compaction
* rework compaction cleanup logic to work with multiple resulting files
* ensure the uint64 number for a series key doesn't use 0 or MaxInt64 for sentinel values
2015-10-22 08:34:02 -04:00
Jason Wilder f66de17e8a Move closing channel init before first usage
Fix a test that closes and re-opens the same WAL.
2015-10-21 23:47:29 -06:00
Jason Wilder 6db5429d06 Fix deadlock when closing WAL and flush is running
Close acquired the cacheLock and writeLock in a different order than flush.  If addToCache was also
running in a goroutine (acquiring cacheLock), a deadlock could happen.
2015-10-21 23:46:59 -06:00
Jason Wilder 4f31b8fab9 Fix panic: error opening new segment file for wal
panic: error opening new segment file for wal: open /var/folders/lj/vlbynqp52pxdxxlxx64j6bk80000gn/T/tsm1-test709000715/_00002.wal: no such file or directory

goroutine 8 [running]:
github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Log).writeToLog(0xc820098500, 0x1, 0xc8201584b0, 0x1c, 0x45, 0x0, 0x0)
	/Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/wal.go:427 +0xc19
2015-10-21 23:46:09 -06:00
Jason Wilder 4ac67259f7 Fix data race in filesAndLock/Compact
WARNING: DATA RACE
Write by goroutine 10:
  github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Engine).Compact()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1.go:716 +0x1a3e
  github.com/influxdb/influxdb/tsdb/engine/tsm1_test.TestEngine_WriteCompaction_Concurrent.func2()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1_test.go:422 +0xc8

Previous read by goroutine 9:
  github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Engine).filesAndLock()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1.go:476 +0xe8
  github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Engine).Write()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1.go:370 +0x216
  github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Log).flush()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/wal.go:604 +0xef4
  github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Log).WritePoints()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/wal.go:243 +0x794
  github.com/influxdb/influxdb/tsdb/engine/tsm1.(*Engine).WritePoints()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1.go:350 +0xb0
  github.com/influxdb/influxdb/tsdb/engine/tsm1_test.TestEngine_WriteCompaction_Concurrent.func1()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1_test.go:401 +0x432

Goroutine 10 (running) created at:
  github.com/influxdb/influxdb/tsdb/engine/tsm1_test.TestEngine_WriteCompaction_Concurrent()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1_test.go:426 +0x225
  testing.tRunner()
      /private/var/folders/q8/bf_4b1ts2zj0l7b0p1dv36lr0000gp/T/workdir/go/src/testing/testing.go:456 +0xdc

Goroutine 9 (running) created at:
  github.com/influxdb/influxdb/tsdb/engine/tsm1_test.TestEngine_WriteCompaction_Concurrent()
      /Users/jason/go/src/github.com/influxdb/influxdb/tsdb/engine/tsm1/tsm1_test.go:406 +0x182
  testing.tRunner()
      /private/var/folders/q8/bf_4b1ts2zj0l7b0p1dv36lr0000gp/T/workdir/go/src/testing/testing.go:456 +0xdc
2015-10-21 16:38:35 -06:00
Jason Wilder cf8a7c6d9a Fix panic: assignment to entry in nil map
WAL.addToCache could if WritePoints call is running when the WAL is
closed.
2015-10-21 16:33:36 -06:00
Jason Wilder 4c4ffda30a Add WAL write/flush concurrently test 2015-10-21 16:33:26 -06:00
Jason Wilder 965827c8e8 Add test for writing/querying series with mixed field numbers 2015-10-21 15:21:28 -06:00
Jason Wilder 1922a4010f Add test for writin/querying point earlier than first stored 2015-10-21 15:21:28 -06:00
Jason Wilder 11bcb0f95a Add test for data races in tsm1 Write
Running this test with -race triggers a number of data races.
2015-10-21 12:26:39 -06:00
Jason Wilder e2ada3c59b Log errors when flushes fail
There errors were getting silently dropped which might be hiding
problems.
2015-10-21 09:12:34 -06:00
Jason Wilder efea0edb82 Merge pull request #4504 from influxdb/jw-4444
Fix panic: runtime error: index out of range - Values.MinTime
2015-10-19 13:44:28 -06:00
Jason Wilder ba73b1fac6 Fix panic: runtime error: index out of range - Values.MinTime
When rewriting a tsm file, a panice on the Values slice could happen
if there were no values in the slice and the conditions of the rewrite
causes DecodeAndCombine to be called with the empty slice.  This could
happen is the sizes of the points new values was equal to
the MaxPointsInBlock config options and there were no future blocks after
the current one being written.

When this happens, DecodeAndCombine returns a zero length remaining values
slice which is passed back into DecodeAndCombine one last time.  In this case,
we now just return the original block since there is nothing new to combine.

Fixes #4444 #4365
2015-10-19 13:31:43 -06:00
David Norton 401447cbed feat #3523: filter SHOW MEASUREMENTS by WITH 2015-10-19 14:00:53 -04:00
Daniel Morsing e73c37088f Merge pull request #4454 from influxdb/intofixes
Intofixes
2015-10-19 18:58:42 +01:00
David Norton 203a411eec fix #4475: correct error msg for SHOW TAG VALUES 2015-10-16 10:37:08 -04:00
Philip O'Toole 100ca62f5c Fix build after go metalinter cleanup 2015-10-16 07:02:39 -07:00
Paul Dix f4d8271006 Merge pull request #4402 from influxdb/pd-tsm-file-size-limit
TSM1 fixes
2015-10-16 07:46:08 -04:00
Paul Dix ba41d6fd92 remove failing test 2015-10-16 07:25:33 -04:00
Cory LaNou a2102e19ba always return time, never strings. fixes #4415 2015-10-15 20:19:58 -05:00
Nathaniel Cook bc2a95a877 Merge pull request #4455 from influxdb/nc-mr-signatures
update reduce func signatures to not have influxql.Call arguments
2015-10-15 15:16:39 -06:00
Ben Johnson c27f8ae3a4 tsm1 meta lint 2015-10-15 15:03:10 -06:00
Jason Wilder ae925625ce Merge pull request #4451 from influxdb/jw-int64
Int64 encoding enhancements
2015-10-15 13:44:55 -06:00
Jason Wilder 3db28cfe99 Fix typos 2015-10-15 13:36:42 -06:00
Nathaniel Cook d338f38d65 update reduce func signatures to not have influxql.Call arguments 2015-10-15 09:24:16 -06:00
Daniel Morsing 13f6fd6238 Add measurement reference back to CQs
CQs has a feature where you can tell it to use the name of the originating measurement as the target name. This was missed when I reimplemented it.
2015-10-15 13:10:38 +00:00
Daniel Morsing d990b5f28d fix into queries when encountering nil values.
For aggregate queries, having a null result means that you haven't
got any data for that time period. CQs used this as a signal that
the measurement was not created and dropped the entire write.

INTO queries can have any structure, including wildcards, so dropping
the entire query isn't going to work. Instead, just drop the nulls
returned.
2015-10-15 12:12:40 +00:00
Jason Wilder c037ae1416 Add run-length encoding to int64 encoder
This encoding can really help counter values with large runs of the same
value (e.g. a counter that is 0 for long periods of time).
2015-10-14 19:23:58 -06:00
Jason Wilder 014c51f32a Delta-encode int64 before bit packing
This will help large integer counters type fields that increment by
small amounts over time.  Instead of storing the larger raw value
in a compressed format, we store the difference from the prior value
in compressed format which allows the value to be stored using
fewer bits.
2015-10-14 19:23:51 -06:00
Sean Beckett 82f104a8b1 Merge pull request #4436 from influxdb/tag-names-to-keys
WIP tag name --> tag key, field name --> field key
2015-10-14 16:02:46 -07:00
Ben Johnson f2d23b070b add tsm1 wal quickcheck
This commit adds quickcheck testing for the tsm1 WAL.
2015-10-14 09:38:38 -06:00
Daniel Morsing 6d188d9703 Merge pull request #4409 from influxdb/intoq
wire up INTO queries.
2015-10-14 15:29:54 +01:00
Philip O'Toole 6d38559f24 RLock access to store's shards
Fix issue #4442.
2015-10-13 20:28:19 -07:00