131 Commits

Author SHA1 Message Date
Fabian Reinartz
d4779b374c Properly track and write meta file 2017-01-19 14:01:38 +01:00
Fabian Reinartz
9ddbd64d00 Move stats into meta.json file, cleanup, docs 2017-01-19 11:22:47 +01:00
Fabian Reinartz
e006bc6dc6 Improve error messages, create regular dir for block 2017-01-19 08:40:15 +01:00
Fabian Reinartz
d2322f6095 Improve compaction processing 2017-01-18 06:18:32 +01:00
Fabian Reinartz
343dd9d94c Fix wrong byte size in WAL base ref 2017-01-17 08:40:31 +01:00
Fabian Reinartz
dd0b69fe1b Export ErrNotFound 2017-01-16 14:18:32 +01:00
Fabian Reinartz
1c80c33e72 Fix bug of unsorted postings lists being created
The former approach created unordered postings list by either
map iteration of new series being unsorted (fixable) or concurrent
writers creating new series interleaved.

We switch back to generating ephemeral references for a single batch.
Newly created series have to be re-set upon the next insert.
2017-01-13 16:22:20 +01:00
Fabian Reinartz
c7f5590a71 Ensure order of postings when adding new series 2017-01-13 15:25:11 +01:00
Fabian Reinartz
d970f0256a Add Rollback() and docs to Appender interface 2017-01-12 20:17:49 +01:00
Fabian Reinartz
22db9c3413 Remove old appendBatch methods 2017-01-12 20:04:49 +01:00
Fabian Reinartz
a317f252b9 Expose series references to clients
This exposes a reference number of a series represented by a label set
to clients.
Subsequent samples can be directly added via the reference rather than
repeatedly passing in the full labels. This drasitcally speeds up the
append process.

The appender chain uses different sections of the reference number for
assignment to child appenders and invalidating reference numbers as
necessary.

Clients can either pass out reference numbers themselves or have their
own optimized lookup, i.e. by directly associating unparsed metric
descriptors strings with reference numbers.
2017-01-12 20:00:54 +01:00
Fabian Reinartz
c32a94d409 Unexport HeadBlock, export Block interface 2017-01-10 15:41:57 +01:00
Fabian Reinartz
29883a18fc Add own Appender() method for DB 2017-01-09 22:54:08 +01:00
Fabian Reinartz
142c89b8b0 Fix/update metrics 2017-01-09 19:14:21 +01:00
Fabian Reinartz
8c31c6e934 Make concurrent head chunk reads safe, fix misc races
This adds a 4 sample buffer to every head chunk. The XOR
compression scheme may edit bytes in place. The minimum size
of a sample is 2 bits. So keeping the last 4 samples in an in-memory
buffer makes it safe to query the preceeding ones while samples
are added
2017-01-09 16:51:39 +01:00
Fabian Reinartz
1943f8d1bb Fix head block stats races 2017-01-07 18:02:17 +01:00
Fabian Reinartz
300f4e2abf Use separate lock for series creation
This uses the head block's own lock to only lock if new series were
encountered.
In the general append case we just need to hold a
2017-01-06 18:10:50 +01:00
Fabian Reinartz
63e12807da Don't update head postings mapper on every append 2017-01-06 16:43:18 +01:00
Fabian Reinartz
71efd2e08d Periodically fsync WAL, make head cut async 2017-01-06 15:18:06 +01:00
Fabian Reinartz
2eb544c98e Change file names and maker parsing safer 2017-01-06 13:13:22 +01:00
Fabian Reinartz
96c2bd249f Handle compaction trigger and reinitializing in DB 2017-01-06 13:03:23 +01:00
Fabian Reinartz
3ed2c2a14b Rename Partition to regular DB, DB to PartitionedDB 2017-01-06 11:40:09 +01:00
Fabian Reinartz
937cdb579c Switch to sequential block names
This changes block directory names from the int64 timestamp
to sequential numbering.
2017-01-06 10:45:03 +01:00
Fabian Reinartz
4590b61343 Rename shard to partition 2017-01-06 08:08:02 +01:00
Fabian Reinartz
5aa7f7cce8 Compact head block into persisted block 2017-01-04 21:11:15 +01:00
Fabian Reinartz
3f72d5d027 Fix last timestamp initialization
This initializes the chunkDesc's last timestamp to the minimum
value so initial samples with a timestamp of 0 (e.g. in tests)
are not accidentally dropped.
2017-01-04 14:06:40 +01:00
Fabian Reinartz
ec99f99d3d Fix and test bug in shardSeriesSet 2017-01-03 19:02:42 +01:00
Fabian Reinartz
ac49f8c15e Consolidate persistence and compaction 2017-01-03 16:49:37 +01:00
Fabian Reinartz
91b65b55e7 Run persistence in separate goroutine 2017-01-02 22:24:35 +01:00
Fabian Reinartz
a648ef5252 Convert persister into function 2017-01-02 16:58:47 +01:00
Fabian Reinartz
dbd2b21d2e Make persistence atomic 2017-01-02 14:41:13 +01:00
Fabian Reinartz
62b8ded0a5 Rename iterator value getters to At() 2017-01-02 13:33:06 +01:00
Fabian Reinartz
5d75a3dc7b Add basic compaction
This adds a basic compactor that will merge two persisted blocks into
one. It simply fully rewrites the index and concatenates the chunk
lists.

It just writes into the current working dir and doesn't properly handle
which blocks to compact for now.
2017-01-02 10:34:55 +01:00
Fabian Reinartz
c00d17e691 Modify IndexReader API to accomodate compaction
This changes the IndexReader API to expose plain labels
and chunk meta information instead of a Series interface.
Dropping of irrelevant chunks is moved into the querier.

A LabelIndices method is added to query for existing label
value indices.
2016-12-31 16:24:04 +01:00
Fabian Reinartz
1e1a37b15b Remove double-reference in chunk hashmap 2016-12-31 10:19:02 +01:00
Fabian Reinartz
675f0886f0 Append to chunks cannot error 2016-12-31 10:10:27 +01:00
Fabian Reinartz
7280533c42 Add basic shard metrics 2016-12-31 09:48:49 +01:00
Fabian Reinartz
a009247ab7 Add matching of empty label 2016-12-30 19:36:28 +01:00
Fabian Reinartz
eb4f366988 Add return error to Appender.Add 2016-12-29 11:03:39 +01:00
Fabian Reinartz
3a5468f251 Lock shards during querying and shutdown 2016-12-28 11:41:44 +01:00
Fabian Reinartz
ab7fbc05ad Zero timestamp as base, use binary search list postings 2016-12-28 08:50:20 +01:00
Fabian Reinartz
f8111cef0e Fix chunk series iterator seeking 2016-12-26 16:55:44 +01:00
Fabian Reinartz
787199a88e Fix erroneous value assignments 2016-12-22 20:57:00 +01:00
Fabian Reinartz
8aba95048a Rename to OpenHeadBlock 2016-12-22 20:00:24 +01:00
Fabian Reinartz
9c6a72aadd Load head with WALs correctly 2016-12-22 15:54:39 +01:00
Fabian Reinartz
1dde3b6d31 Add WAL decoder+loading and benchmarks 2016-12-22 15:18:33 +01:00
Fabian Reinartz
0b8c77361e Add initial WAL writing 2016-12-22 12:05:24 +01:00
Fabian Reinartz
2a825f6c28 Consolidate mem index into HeadBlock 2016-12-22 01:12:28 +01:00
Fabian Reinartz
da2beb3e6d Fix zero division, add buffer series iterator 2016-12-21 13:04:51 +01:00
Fabian Reinartz
ede733ab6c Extract labels package 2016-12-21 09:39:01 +01:00