prometheus/tsdb
Bartlomiej Plotka d5c33877f9
storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation. (#7005)
* storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation.

## Rationales:

In many places (e.g. chunk Remote read, Thanos Receive fetching chunk from TSDB), we operate on encoded chunks not samples.
This means that we unnecessary decode/encode, wasting CPU, time and memory.
This PR adds chunk iterator interfaces and makes the merge code to be reused between both seriesSets

I will make the use of it in following PR inside tsdb itself. For now fanout implements it and mergers.

All merges now also allows passing series mergers. This opens doors for custom deduplications other than TSDB vertical ones (e.g. offline one we have in Thanos).

## Changes

* Added Chunk versions of all iterating methods. It all starts in Querier/ChunkQuerier. The plan is that
Storage will implement both chunked and samples.
* Added Seek to chunks.Iterator interface for iterating over chunks.
* NewMergeChunkQuerier was added; Both this and NewMergeQuerier are now using generigMergeQuerier to share the code. Generic code was added.
* Improved tests.
* Added some TODO for further simplifications in next PRs.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Addressed Brian's comments.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Moved s/Labeled/SeriesLabels as per Krasi suggestion.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Addressed Krasi's comments.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Second iteration of Krasi comments.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

* Another round of comments.

Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
2020-03-24 20:15:47 +00:00
..
chunkenc storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation. (#7005) 2020-03-24 20:15:47 +00:00
chunks storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation. (#7005) 2020-03-24 20:15:47 +00:00
cmd/tsdb storage: Removed SelectSorted method; Simplified interface; Added requirement for remote read to sort response. 2020-03-20 21:14:43 +01:00
docs/format Live m-mapping of chunks on disk (#6830) 2020-03-19 22:03:44 +05:30
encoding Avoid WriteAt for Postings. 2019-12-16 15:30:49 +00:00
errors Moving tsdb into its own subdirectory 2019-08-13 13:58:49 +05:30
fileutil Live m-mapping of chunks on disk (#6830) 2020-03-19 22:03:44 +05:30
goversion Fix some typo in comments (#6730) 2020-01-31 12:11:52 +05:30
index tsdb: writePostingsToTmpFiles returns nil instead of err (#6618) 2020-01-13 22:40:12 +00:00
record Spelling (#6517) 2020-01-02 15:54:09 +01:00
test Port tsdb to use pkg/labels. (#6326) 2019-11-18 11:53:33 -08:00
testdata Handle V1 indexes, some of which have unsorted posting offset tables. (#6564) 2020-01-06 14:06:11 +00:00
tombstones tsdb: add tombstonesHeaderSize constant (#7028) 2020-03-22 12:59:35 +05:30
tsdbutil storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation. (#7005) 2020-03-24 20:15:47 +00:00
wal Fix golint issues. 2020-03-23 20:38:43 +01:00
.gitignore Moving tsdb into its own subdirectory 2019-08-13 13:58:49 +05:30
block.go Make TSDB use storage errors 2020-03-17 22:24:25 +01:00
block_test.go storage: Removed SelectSorted method; Simplified interface; Added requirement for remote read to sort response. 2020-03-20 21:14:43 +01:00
CHANGELOG.md Spelling (#6517) 2020-01-02 15:54:09 +01:00
compact.go storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation. (#7005) 2020-03-24 20:15:47 +00:00
compact_test.go Make head Postings only return series in time range 2020-02-20 22:41:46 +01:00
db.go Fix golint issues. 2020-03-23 20:38:43 +01:00
db_test.go storage: Removed SelectSorted method; Simplified interface; Added requirement for remote read to sort response. 2020-03-20 21:14:43 +01:00
head.go Make TSDB use storage errors 2020-03-17 22:24:25 +01:00
head_bench_test.go Make head Postings only return series in time range 2020-02-20 22:41:46 +01:00
head_test.go Fix TestHeadDeleteSimple to test reloaded Head too (#7021) 2020-03-23 16:55:25 +02:00
isolation.go Do not attempt isolation for appendID == 0 2020-03-01 02:48:35 +01:00
mocks_test.go Make head Postings only return series in time range 2020-02-20 22:41:46 +01:00
querier.go storage: Added Chunks{Queryable/Querier/SeriesSet/Series/Iteratable. Added generic Merge{SeriesSet/Querier} implementation. (#7005) 2020-03-24 20:15:47 +00:00
querier_bench_test.go storage: Removed SelectSorted method; Simplified interface; Added requirement for remote read to sort response. 2020-03-20 21:14:43 +01:00
querier_test.go Fix golint issues. 2020-03-23 20:38:43 +01:00
README.md Edit TSDB README badges 2019-10-24 15:35:47 +05:30
repair.go tsdb: fix typo for wrong metric name (#6938) 2020-03-09 08:25:31 +00:00
repair_test.go Port tsdb to use pkg/labels. (#6326) 2019-11-18 11:53:33 -08:00
tsdbblockutil.go Fix golint issues. 2020-03-23 20:38:43 +01:00
wal.go Spelling (#6517) 2020-01-02 15:54:09 +01:00
wal_test.go Spelling (#6517) 2020-01-02 15:54:09 +01:00

TSDB

GoDoc

This repository contains the Prometheus storage layer that is used in its 2.x releases.

A writeup of its design can be found here.

Based on the Gorilla TSDB white papers.

Video: Storing 16 Bytes at Scale from PromCon 2017.

See also the format documentation.