Commit Graph

844 Commits (c1d6c14c47dfb4d60878a979fbdd8b526281d3d6)

Author SHA1 Message Date
Jason Wilder 3a8a19a99d Implement LoadMetaDataIndex for tsm1dev engine 2015-12-02 13:38:06 -07:00
Jason Wilder 3014d7e391 Return errors for func not implemented in tsm1dev engine 2015-12-02 11:06:01 -07:00
Jason Wilder a7e21c2975 Don't set a cache memory limit by default
100mb is easy it hit even with basic stress test config.  Don't set
a limit by default so that an operator can size it appropriately based
on their hardware.
2015-12-02 11:01:13 -07:00
Jason Wilder 6847a6ba0c Fix rebase 2015-12-02 09:47:16 -07:00
Jason Wilder 751d1dd467 Don't rewrite TSM files while WAL segments exist
This approach is not working and needs to be reworked.
2015-12-02 09:45:24 -07:00
Jason Wilder 5744f5ba02 Add ability to filter values by time when writing TSM files 2015-12-02 09:45:24 -07:00
Jason Wilder 708266da69 Cache related compaction fixes 2015-12-02 09:45:24 -07:00
Jason Wilder 231c052003 Don't limit WAL segments during compaction
Since they are already loaded in the cache, this limit is not really
needed anymore.
2015-12-02 09:45:24 -07:00
Jason Wilder 7e249e0555 Use CacheKeyIterator instead of WALKeyIterator during compactions 2015-12-02 09:45:24 -07:00
Jason Wilder 4a03469662 Integrate TSM compaction into dev engine 2015-12-02 09:45:23 -07:00
Jason Wilder 78fda2b89b Implement WAL SegmentStats for compactions 2015-12-02 09:45:23 -07:00
Jason Wilder 1485ea7e41 Implement Size on TSMReader 2015-12-02 09:45:23 -07:00
Jason Wilder d4b1c25f8e Add CompactionPlanner type
CompactionPlanner is used to determine which files (WAL Segments, TSM
Files) to include in a given compaction run.
2015-12-02 09:45:23 -07:00
Jason Wilder 5291fbcf39 Add TSM support to MergeIterator
Enables the ability to combine multiple TSM files into one as well
as merge existing TSM files with newer WAL segment values.
2015-12-02 09:45:23 -07:00
Jason Wilder acdb6bcdf6 Add TSMKeyIterator
Allows iterating of multiple TSM files in sort key and values order.
2015-12-02 09:45:23 -07:00
Jason Wilder 4b6767bf01 Add MMAP based file reader 2015-12-02 09:45:23 -07:00
liang@qiniu.com d8715ee3dd Order the MapItems by timestamp 2015-12-02 10:47:12 +08:00
Philip O'Toole fc83968e2e Cache values supports sorting order 2015-12-01 13:24:25 -08:00
Philip O'Toole 3a72e40e3f Implement descending cursor support 2015-12-01 13:24:25 -08:00
Philip O'Toole ec4daaccff Test ascending tsm1dev cursor 2015-12-01 13:24:25 -08:00
Philip O'Toole 59674fda21 Integrate cache query with tsm1dev engine 2015-12-01 13:24:25 -08:00
Philip O'Toole 7da3fc1aeb Merge pull request #4934 from influxdb/dedupe_sort_order
Deduplicate supports requesting sort order
2015-12-01 16:23:25 -05:00
liang@qiniu.com 0d6b2f34fa Fix distributed aggregative query error 2015-12-01 19:56:06 +08:00
Philip O'Toole bad0f657de Deduplicate supports requesting sort order 2015-11-30 16:21:44 -08:00
Philip O'Toole 6b3c6a90a1 Merge pull request #4911 from influxdb/integrate_cache
Integrate cache with tsm1dev write path
2015-11-30 14:58:42 -08:00
liang@qiniu.com b858b11286 fix network closed error when show measurements 2015-11-30 10:44:00 +08:00
Philip O'Toole 8649ce4c49 Integrate cache with tsm1dev write path 2015-11-26 06:07:19 -08:00
Philip O'Toole 1bca38bb84 Cache supports writing multiple keys
This keeps the locking to a minimum if the data is available for
multiple keys at once.
2015-11-26 06:07:16 -08:00
Ben Johnson 41459cf687 fix flush deadlock
This commit fixes a deadlock that occurs during b1 flushes. It's
caused by taking locks in a different order. In the flush, b1
locks the engine and then bolt. However, in the query cursor, a
lock is obtained on bolt first (via `DB.Begin()`) and then the
engine is locked while reading from the engine's cache.
2015-11-25 15:00:06 -07:00
Philip O'Toole 8e7dc3bef9 WAL returns current segment ID on write and delete 2015-11-25 12:23:10 -08:00
Philip O'Toole bce68ed43d Merge pull request #4833 from li-ang/fix_show_measurements
Fix SHOW MEASUREMENTS across the cluster
2015-11-25 10:47:44 -08:00
Cory LaNou ce8cf05b0e Merge pull request #4889 from influxdb/mapper-execute-close
Implement close notifier and timeout on executors
2015-11-25 08:24:00 -06:00
Jason Wilder d931f5dd22 Merge pull request #4900 from influxdb/jw-compact
WAL segment compaction
2015-11-24 21:35:13 -07:00
Jason Wilder 34bffd5e18 Code review fixes 2015-11-24 21:24:13 -07:00
Cory LaNou be488b7d12 implement close notifier and timeout on executors 2015-11-24 21:07:18 -06:00
Jason Wilder 1ce8d6290b Remove values pool replacement
Getting an intermittent test failure with this so removing it for now since compactions
are still able to keep up without it.  Will need to look into this further because the
allocations is still very high and will affect compactions over longer periods of time.
2015-11-24 13:40:07 -07:00
Jason Wilder 0832a03333 Move pools to separate file 2015-11-24 09:44:37 -07:00
Jason Wilder a6541937f8 Add dumptsmdev to influx_inspect
Allow inspecting the updated TSM format.
2015-11-24 08:50:13 -07:00
Jason Wilder 25206c729c Add compactor type 2015-11-24 08:50:07 -07:00
Philip O'Toole f8b4950ea9 Enhance tsm1dev logging 2015-11-23 14:24:39 -08:00
Jason Wilder f70323cb89 Add MergeIterator
MergeIterator will be used to merge multiple TSM KeyIterators and the
WAL KeyIterator using a stream based iteration approach.  Each iteration
cycle returns a key and values ordered in way to write a new TSM file
optimally.
2015-11-23 14:59:15 -07:00
Jason Wilder 5334271e26 Add KeyIterator for WAL segments
This provides and interface and type to combine multiple WAL segments
in order and then allow the values to be read in an order suitable for
writing to a TSM file.
2015-11-23 14:59:15 -07:00
Jason Wilder d2b045f89b Code cleanup 2015-11-23 14:03:50 -07:00
Jason Wilder 697cfe604b Add stubbed out dev tsm engine
Starting to integrate some of the components into a engine that is
usable for development purposes.  This allows the code to evolve while
keeping the existing TSM engine in tact for reference.

Currently, just the WAL is wired up so writes can be tested.  Other engine
functions will panic the server if called.
2015-11-23 13:55:34 -07:00
Jason Wilder 7461b61bf2 Fix race in WAL and WALSegmentWriter
WAL currentSegmentWriter was not accessed under a mutex.  The WALSegmentWriter
also did not use a mutex to protect the underlying writer.
2015-11-23 13:55:34 -07:00
Jason Wilder aa00ef953a Fix typo in func names 2015-11-23 13:55:34 -07:00
Jason Wilder e2b1a09ece Implemment WAL write/delete functions 2015-11-23 13:55:33 -07:00
Jason Wilder afc0d5bfb9 Add WALSegmentReader/Writer
Basic types for reading and writing WAL segment files.
2015-11-23 13:55:33 -07:00
Jason Wilder 151b33d000 Rename wal.go to log.go
This is the existing WAL + cache implementation.  Moving it to a separate file
so that it can remain intact while a refactoring to a independent WAL can occur.

The WAL was also named Log in the code so this names file more closely to the concept
in the code.
2015-11-23 13:53:30 -07:00
Philip O'Toole 1a77c76245 Merge pull request #4863 from influxdb/simple_wal_cache
Move to simpler cache
2015-11-23 12:49:58 -08:00
Philip O'Toole 19f53d8a75 Add some simple benchmarks 2015-11-20 21:09:44 -08:00
Philip O'Toole 5b573b9248 Move to simpler cache
This cache simply evicts as much as possible whenever a checkpoint is
set.
2015-11-20 21:09:24 -08:00
mengjinglei 9b6cdb4622 fix Top&Bottom function 2015-11-21 09:36:55 +08:00
mengjingleli c94077e23a fix min&max 2015-11-21 09:29:17 +08:00
liang@qiniu.com b9c91eb52a fix show measurements across the cluster 2015-11-18 17:17:37 +08:00
Jason Wilder 0d1508a7c6 Add comments for search 2015-11-17 23:24:10 -07:00
Jason Wilder a7d7c280ed Add block type to index
This will faciliate loading a block into a type specific result without
first loading the block.  This will also allow us to populate the database
index solely from the index.
2015-11-17 23:24:09 -07:00
Jason Wilder e5022a898d Support decoding into type specific slices
There is a lot of allocations performed when decoding blocks.  These
types can be re-used to reduce allocations in many cases.  This change
allows a type specific slice to be passed in to decode funcs to be re-used
if it is large enough.

The existing decode is is left for backwards compatibility but is not
very efficient right now.  It may be removed.
2015-11-17 23:24:09 -07:00
Jason Wilder 5a12c49475 Make type specific decoders exported 2015-11-17 23:24:09 -07:00
Jason Wilder d517bad6f2 Add BlockType func
Allows the block type to be determined without decoding all the values.
2015-11-17 23:24:09 -07:00
Philip O'Toole 6aede8f562 Clone should sort values
This code may actually change soon due to internal design changes, but
this will ensure testing output is constant.
2015-11-17 11:59:50 -08:00
Philip O'Toole 76b02c9143 Merge pull request #4812 from influxdb/checkpointed_wal_tsm_cache
Checkpointed WAL tsm1 cache
2015-11-17 11:27:00 -08:00
Jason Wilder bd0a89bb00 Merge pull request #4808 from influxdb/jw-tsm
Add FileStore for TSM files
2015-11-17 12:11:26 -07:00
Jason Wilder 7c7a68d783 Small cleanups 2015-11-17 11:30:29 -07:00
Cory LaNou c12881ff10 Merge pull request #4822 from influxdb/fix-4193
Fix time inclusive comparison
2015-11-17 10:50:51 -06:00
Cory LaNou 6309ec9a68 fix time inclusive comparison 2015-11-17 10:43:27 -06:00
Philip O'Toole b46e10e40c Merge pull request #4818 from CrazyJvm/cluster-panic
check point without fields when NewPoint
2015-11-17 08:29:18 -08:00
Cory LaNou c24c2f720a refactor newPointHeap 2015-11-17 09:17:35 -06:00
CrazyJvm 6e60e3226a check point without fields when NewPoint 2015-11-17 13:21:52 +08:00
Philip O'Toole d8ea132c53 Add WAL cache 2015-11-16 19:52:49 -08:00
Cory LaNou 824d7a1d9b Add interface for heap to support Reverse for `order by desc` 2015-11-16 15:10:55 -06:00
Jason Wilder 9c2be12b65 Add FileStore.Remove func
Allows a TSMFile to be removed from the active set of files managed
by the FileStore.
2015-11-16 09:16:10 -07:00
Jason Wilder c2530e93d7 Add mutexes around seeker usage
These are not goroutine safe.
2015-11-16 09:05:27 -07:00
Jason Wilder ef18f8afb2 Handle TSM key deletions
This writes a tombstone file containing a line per deleted key. This
file is read when a TSMReader is created and any keys listed in the file
are removed from the index.
2015-11-16 08:44:52 -07:00
Jason Wilder ed7cfb6df3 Add Keys function to TSMIndex
Useful for testing
2015-11-16 08:44:52 -07:00
Jason Wilder d8c0c26934 Return error if number of blocks would overflow 2015-11-16 08:44:52 -07:00
Jason Wilder 16c5e0a2e0 Add Close to TSMWriter interface 2015-11-16 08:44:52 -07:00
Jason Wilder b279534f2a Remove type specific casts in encoders
This prevented the encoders from using other implementations of the Value
interface because it would always cast one of the types to our specific
implementations.
2015-11-16 08:44:52 -07:00
Jason Wilder 0ab423c7ff Initial FileStore implementation
Provides functionality to load a directory of TSM files (or add them manually)
as well as reading blocks of values for individual key and times.
2015-11-16 08:44:52 -07:00
Philip O'Toole 912684b8d6 WHERE fields must be decoded during aggregates
This change ensures that if there are any fields in the WHERE clause of
an aggregate that are different from the fields in the SELECT clause,
that the cursors also decode those fields. Otherwise WHERE clauses of
the form 'SELECT f(w) FROM x WHERE y=z' will return incorrect results

Fixes issue #4701.
2015-11-13 15:18:54 -08:00
Philip O'Toole f889ac1140 If no points to count, count is 0
Fix issue #4701.
2015-11-12 18:52:58 -08:00
Jason Wilder f56f3ae1e0 Merge pull request #4756 from influxdb/jw-tsm
TSM file reader/writers
2015-11-12 11:07:02 -07:00
Jason Wilder e4312d854c Fix typo 2015-11-12 09:53:38 -07:00
Jason Wilder 8e14877e98 Add diagrams/documentation about indirect indexing strategy 2015-11-11 17:01:20 -07:00
Jason Wilder 7df1c2dd31 Add an indirectIndex implementation
Implements the indirect indexing approach to allow indexes on MMAPed files
that may be larger than available RAM
2015-11-11 15:16:11 -07:00
Ross McDonald 2c687abf91 Removing reference to strings.Compare for downgrade from Go 1.5 to Go 1.4. 2015-11-11 14:40:34 -06:00
Jason Wilder 06016882ab Add revised TSM file writer/readers
This adds some basic file reader/writers for creating the updated TSM file format.  It uses a simple
in-memory index without MMAP for now, but will be extended to use and indirect indexing approach as well as MMAPed file access as described in the design doc.

This code is not integrated into the TSM engine yet
2015-11-11 12:52:34 -07:00
Nathaniel Cook 5cc7fa912e export interfaceValues since it is returned from the DisticntReduce function 2015-11-09 16:35:00 -07:00
Jason Wilder 9312921ae2 Add non-mmap file indexing option 2015-11-09 16:04:00 -07:00
Jason Wilder 44077851ca Design review updates
* Add file/block design option ideas
* Update cache eviction policy
2015-11-09 15:56:26 -07:00
Jason Wilder 9239e3132f Add design doc 2015-11-09 15:08:47 -07:00
ch33hau 2235dcec6b Added IF EXISTS for DROP DATABASE command, #4659 2015-11-07 10:57:49 +08:00
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
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
Sean Beckett 1d83c8c427 Update meta.go 2015-10-13 16:46:59 -07:00
Daniel Morsing 62dff895e2 wire up INTO queries.
Since INTO queries need to have absolute information about the database
to work, we need to create a loopback interface back to the cluster
in order to perform them.
2015-10-13 15:00:36 +00:00
Cory LaNou 6787525912 fixes multiple selectors overwriting each other. fixes #4360 2015-10-12 21:40:57 -05:00
Jason Wilder 16b3084ca9 Merge pull request #4397 from influxdb/jw-tsmdump
tsm1 file dump
2015-10-12 08:12:23 -06:00
Paul Dix a99c9ec5af Ensure rewrite index doesn't write corrupt file.
Fixes #4401
2015-10-10 16:58:25 -04:00
Jason Wilder 629219951a Fix timestamp encoding not using run-length encoding when possible
influx_inpsect uncovered some scenarios where timestamps could be stored using
run-length encoding but were being stored using simple8 which uses more space.
2015-10-09 22:38:17 -06:00
David Norton 9627f5ab84 fix #4280: add comments based on code review 2015-10-09 18:38:33 -04:00
David Norton 512d6ac050 fix #4280: only drop points matching WHERE clause 2015-10-09 18:34:32 -04:00
Jason Wilder 758359accc Prevent panic in DecodeSameTypeBlock
If DecodeSameTypeBlock is called on on an empty Values slice, it would
panic with an index out of bounds error.  This func can actually be removed
because DecodeBlock can determine what type of values are encoded already.

This will still panic if the block cannot be decoded due to other reasons.

Fixes #4365
2015-10-09 12:52:23 -06:00
Ben Johnson 2b3bb5336d add tsm1 quickcheck tests 2015-10-08 11:59:57 -06:00
Jason Wilder 79185fc1dc Fix index out of bounds panic in int64Decoder
Code was missing a check for when we did not have anymore bytes to decode
so it panic when we tried to decode the empty slice.
2015-10-08 11:21:19 -06:00
Jason Wilder b3343a6d2a Fix similar float values encoding overflow
If similar float values were encoded, the number of leading bits would
overflow the 5 available bits to store them (e.g. store 33 in 5 bits).  When
decoding, the values after the overflowed value would spike to very large and
small values.

To prevent the overflow, we clamp the value to 31 which is the maximum
number of leading zero bits we can encoded.

Fixes #4357
2015-10-07 15:05:56 -06:00
Nathaniel Cook 6f1a44bd07 Merge pull request #4345 from influxdb/remove_iterator
tsdb.Iterator is no longer used. Removing
2015-10-06 17:00:50 -06:00
Paul Dix f041939a1c Merge pull request #4308 from influxdb/pd-storage-engine
The TSM storage engine
2015-10-06 15:54:56 -07:00
Paul Dix b11308133a Only limit field count for non-tsm engines 2015-10-06 15:49:37 -07:00
Paul Dix 40ff4f4a86 Change default to bz1 2015-10-06 15:30:34 -07:00
Jason Wilder 41e3294d4a Fix panic: assignment to entry in nil map
Closing the store did not properly return an error for in-flight
writes because the closing channel was set to nil when closed.  A
nil channel is not selectable so writes continue on past the guard
checks and trigger panics.
2015-10-06 14:03:52 -06:00
Paul Dix be477b2aab Fix cursor bug on index 2015-10-06 12:26:45 -07:00
Nathaniel Cook d380ee37a2 tsdb.Iterator is no longer used. Removing 2015-10-06 10:34:07 -06:00
Paul Dix 267f34b94e Updates based on PR feedback 2015-10-05 20:09:56 -04:00
Paul Dix 26a93ec23e Fix deletes not kept if shutdown before flush on tsm1 2015-10-05 20:09:56 -04:00
Paul Dix bb398daf75 Updates based on @otoolp's PR comments 2015-10-05 20:09:56 -04:00
Jason Wilder c6f2f9cec2 Avoid duplicating values slice when encoding 2015-10-05 20:09:56 -04:00
Jason Wilder cb28dabf62 Make DecodeBlock panic if block size is too small
Should never get a block size 9 bytes since Encode always returns the min
timestampe and a 1 byte header.  If we get this, the engine is confused.
2015-10-05 20:09:56 -04:00
Jason Wilder b0449702e5 Fix comment typos 2015-10-05 20:09:56 -04:00
Paul Dix d9f94bdeeb Add db crash recovery 2015-10-05 20:09:56 -04:00
Jason Wilder 1d754db00b Propogate all encoding errors to engine
Avoid panicing in lower level code and allow the engine to decide what
it should do.
2015-10-05 20:09:56 -04:00
Jason Wilder 4c54c78009 Move compression encoding constants to encoders
Will make it less error-prone to add new encodings int the future
since each encoder has it's set of constants.  There are some placeholder
contants for uncompressed encodings which are not in all encoder currently.
2015-10-05 20:09:56 -04:00
Jason Wilder b1a57e1628 Fix go vet errors 2015-10-05 20:09:56 -04:00
Jason Wilder ab791ba913 Fix TestStoreOpenShardCreateDelete
Shard path can be a directory.
2015-10-05 20:09:56 -04:00
Paul Dix d47ddb5454 Cleanup after pd1 -> tsm1 name change. 2015-10-05 20:09:55 -04:00
Paul Dix 594253cbba Rename storage engine to tsm1, for Time Structured Merge Tree! 2015-10-05 20:09:55 -04:00
Paul Dix 0a11a2fdbc Add deletes to new storage engine 2015-10-05 20:09:55 -04:00
Paul Dix 4beca1a245 Implement reverse cursor direction on pd1 2015-10-05 20:09:55 -04:00
Jason Wilder dbf6228817 Fix go vet 2015-10-05 20:09:55 -04:00
Jason Wilder d9499f0598 Remove zig zag encoding from timestamp encoder
Not needed since all timestamps will be sorted in ascending order.  Negatives
are not possible.
2015-10-05 20:09:55 -04:00
Paul Dix a2b139e006 Fix compaction and multi-write bugs.
* Fix bug with locking when the interval completely covers or is totally inside another one.
* Fix bug with full compactions running when the index is actively being written to.
2015-10-05 20:09:55 -04:00
Jason Wilder 2366baaf0b Handle partial reads when loading WAL
If reading into fixed sized buffer using io.ReadFull, the func can
return io.ErrUnexpectedEOF if the read was short.  This was slipping
through the error handling causing the shard to fail to load.
2015-10-05 20:09:55 -04:00
Paul Dix 3332236527 Fix bugs with writing old data and compaction. 2015-10-05 20:09:55 -04:00
Jason Wilder 5d938d0a8b Add test with duplicate timestamps
Should not happen but makes sure that the same values are encoded
and decoded correctly.
2015-10-05 20:09:55 -04:00
Jason Wilder c47d14540d Add compressed string encoding
Uses snappy to compress multiple strings into a block
2015-10-05 20:09:55 -04:00
Paul Dix 861a15b3e6 Fix panic when data file has small index 2015-10-05 20:09:55 -04:00
Paul Dix be011b8da9 Add logging to pd1 2015-10-05 20:09:54 -04:00
Paul Dix c1213ba367 Update WAL to deduplicate values on Cursor query.
Added test and have failing section for single value encoding.
2015-10-05 20:09:54 -04:00
Jason Wilder 9f9692acdf Rename float encoding tests 2015-10-05 20:09:54 -04:00
Jason Wilder a4d92162ef Add documentation about compression 2015-10-05 20:09:54 -04:00
Jason Wilder 2da52ec4fe Fix deadlock in pd1_test.go
The defer tx.Rollback() tries to free the queryLock but the defer e.Cleanup() runs
before it and tries to take a write lock on the query lock (which blocks) and prevents
tx.Rollback() from acquring the read lock.
2015-10-05 20:09:54 -04:00