Commit Graph

602 Commits (d9a60d7e4c32ce75ca9ef214c48f1ffd1296ad39)

Author SHA1 Message Date
Philip O'Toole de7919240f Migrate internal stats to consistent names
Go style -- and existing runtime stats -- do not use underscores, but
instead use camel case. This change makes the internal stats adhere to
that convention.
2015-10-28 21:07:45 -07:00
Jason Wilder 239f43b529 Remove commented out test skip
[ci skip]
2015-10-28 16:14:54 -06:00
Jason Wilder 1cd30501fd Ensure calling Delete on a deleted file does not panic 2015-10-28 16:11:42 -06:00
Jason Wilder 0db2192f10 Replace use of reflect.DeepEquals with dataFilesEquals
Since the reflect.DeepEquals seems to reach into the dataFile without
acquiring a lock, it's not safe to use it.
2015-10-28 16:02:13 -06:00
Jason Wilder 9d8018297d Prevent writing to a deleted file
When a dataFile is deleted, the f file pointer is set to nil.  Since deleting
a file happens asynchronously, code that had a reference when it was valid may
run when it's gone.
2015-10-28 15:56:46 -06:00
Jason Wilder a1d8af2441 Fix data race in tsm dataFile
dataFile was not protected by a mutex which causes a data race and live
code and tests.  filesAndLock used reflect.DeepEqual on a copy of dataFile
slices.  reflect.DeepEqual appears to access unexported dataFile fields
which can't be protected.  This was changed to use a equals func that will
require a mutex to be acquired.

The other issue was that many of the dataFile funcs access the mmap without
acquiring a lock.  When a dataFile is deleted (possibly during rewriting),
reads from the mmap could return invalid data because references to the dataFile
are still in use by other goroutines.

Fixes #4534
2015-10-28 15:21:36 -06:00
Jason Wilder 7508a2a252 Merge pull request #4587 from influxdb/jw-nan
Prevent NaN float values from being stored
2015-10-28 09:28:04 -06:00
Philip O'Toole 00b2454c53 Exit if invalid engine is selected
Fix #4584, related to #4583
2015-10-27 17:29:18 -07:00
Jason Wilder 4d24b05ac1 Log WAL points that fail to parse
Mainly for debugging as since this should not happen going forward.  Since
there may be points with NaN already stored in the WAL, this is helpful for
troubleshooting panics.
2015-10-27 17:12:56 -06:00
Jason Wilder 7f4a3f516b Return error if NaN is encoded in a block 2015-10-27 17:12:56 -06:00
Jason Wilder 0926b19e6b Prevent creating points with NaN float values
Float values are not supported in the existing engine and the tsm1
engines.  This changes NewPoint to return an error if a field value
contains a NaN field.  It also allows us to validate fields to prevent
other unsupported types from sneaking in through other input plugins.
2015-10-27 17:12:52 -06:00
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