mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
d166da7b59
* TSDB chunks: remove race between writing and reading Because the data is stored as a bit-stream, the last byte in the stream could change if the stream is appended to after an Iterator is obtained. Copy the last byte when the Iterator is created, so we don't have to read it later. Clarify in comments that concurrent Iterator and Appender are allowed, but the chunk must not be modified while an Iterator is created. (This was already the case, in order to copy the bstream slice header.) * TSDB: stop saving last 4 samples in memSeries This extra copy of the last 4 samples was introduced to avoid a race condition between reading the last byte of the chunk and writing to it. But now we have fixed that by having `bstreamReader` copy the last byte, we don't need to copy the last 4 samples. This change saves 56 bytes per series, which is very worthwhile when you have millions or tens of millions of series. * TSDB: tidy up stopIterator re-use Previous changes have left this code duplicating some lines; pull them out to a separate function and tidy up. * TSDB head_test: stop checking when iterators are wrapped The behaviour has changed so chunk iterators are only wrapped when transaction isolation requires them to stop short of the end. This makes tests fail which are checking the type. Tests should check the observable behaviour, not the type. Signed-off-by: Bryan Boreham <bjboreham@gmail.com> Signed-off-by: Ganesh Vernekar <ganeshvern@gmail.com> Co-authored-by: Ganesh Vernekar <ganeshvern@gmail.com> |
||
---|---|---|
.. | ||
agent | ||
chunkenc | ||
chunks | ||
docs | ||
encoding | ||
errors | ||
fileutil | ||
goversion | ||
index | ||
record | ||
test | ||
testdata | ||
tombstones | ||
tsdbutil | ||
wal | ||
.gitignore | ||
block.go | ||
block_test.go | ||
blockwriter.go | ||
blockwriter_test.go | ||
CHANGELOG.md | ||
compact.go | ||
compact_test.go | ||
db.go | ||
db_test.go | ||
example_test.go | ||
exemplar.go | ||
exemplar_test.go | ||
head.go | ||
head_append.go | ||
head_bench_test.go | ||
head_read.go | ||
head_read_test.go | ||
head_test.go | ||
head_wal.go | ||
isolation.go | ||
isolation_test.go | ||
mocks_test.go | ||
ooo_head.go | ||
ooo_head_read.go | ||
ooo_head_read_test.go | ||
ooo_head_test.go | ||
querier.go | ||
querier_bench_test.go | ||
querier_test.go | ||
README.md | ||
repair.go | ||
repair_test.go | ||
tsdbblockutil.go | ||
wal.go | ||
wal_test.go |
TSDB
This directory contains the Prometheus TSDB (Time Series DataBase) library, which handles storage and querying of all Prometheus v2 data.
Documentation
External resources
- A writeup of the original design can be found here.
- Video: Storing 16 Bytes at Scale from PromCon 2017.
- Compression is based on the Gorilla TSDB white paper.
A series of blog posts explaining different components of TSDB: