Commit graph

515 commits

Author SHA1 Message Date
Fabian Reinartz fb9da52b11 Add more verbose error handling for closing, reduce locking
This commit introduces error returns in various places and is explicit
about closing persisted blocks.
{Index,Chunk,Tombstone}Readers are more consistent about their Close()
method. Whenever a reader is retrieved, the corresponding close method
must eventually be called. We use this to track pending readers against
persisted blocks.

Querier's against the DB no longer hold a read lock for their entire
lifecycle. This avoids long running queriers to starve new ones when we
have to acquire a write lock when reloading blocks.
2017-10-10 12:13:37 +02:00
Fabian Reinartz 963a270885 Merge pull request #170 from simonpasquier/fix-typo-in-variable-names
Fix innocuous typo in variable names
2017-10-09 12:38:53 +02:00
Simon Pasquier e858c0826c Fix innocuous typo in variable names
This change fixes the variable names holding the tsdb_head_max_time and
tsdb_head_min_time metrics. It is a cosmetic change to improve the
code readability as the metric values are taken from the correct
variables.
2017-10-09 12:24:53 +02:00
Fabian Reinartz dc87103807 Merge pull request #166 from prometheus/batchpostings
Load postings in batch on startup
2017-10-06 14:41:23 +02:00
Fabian Reinartz 74b0336d06 Merge pull request #167 from simonpasquier/instrument-wal-corruptions
Instrument WAL corruptions
2017-10-06 14:16:41 +02:00
Simon Pasquier 3e17cd1621 Instrument WAL corruptions 2017-10-06 13:50:20 +02:00
Fabian Reinartz cd2e26b7fc Load postings in batch on startup
This allows to insert IDs to postings out of order until
a trigger function is called. This avoids the insertion sort we usually
do which can be very costly since WAL entries are more out of order than
regular adds.
2017-10-06 10:39:10 +02:00
Goutham Veeramachaneni 4a7c39d9d8 Merge pull request #160 from dim/fix/snapshot-test
Restore snapshot functionality
2017-10-05 12:57:10 +05:30
Fabian Reinartz 27f1b8aac3 Merge pull request #162 from BasPH/fsync-duration
Instrument WAL fsync
2017-10-05 08:18:36 +02:00
Bas Harenslak 5e1c258a98 Instrument WAL fsync 2017-10-04 22:17:02 +02:00
Goutham Veeramachaneni da565f975e Merge pull request #161 from prometheus/fileutil
Remove dependency on etcd/pkg/fileutil
2017-10-04 17:08:54 +05:30
Goutham Veeramachaneni 203012169a
snapshot: Remove truncation check to restore func.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-10-04 16:58:07 +05:30
Fabian Reinartz f04ec031eb compact: sync temporary directory 2017-10-04 12:22:09 +02:00
Fabian Reinartz 665d1fd451 Merge pull request #158 from prometheus/cachesym
Allocate and cache strings for persisted blocks
2017-10-04 12:19:50 +02:00
Fabian Reinartz bbe72dccb9 Remove dependency on etcd/pkg/fileutil 2017-10-04 10:23:41 +02:00
Dimitrij Denissenko c9fc2af6c0 Add test for snapshot 2017-10-03 13:06:26 +01:00
Goutham Veeramachaneni 3b7e71fee9 Merge pull request #159 from dim/fix/wal-flush
Use configurable WAL flush interval
2017-10-03 16:17:55 +05:30
Dimitrij Denissenko 83c984d9a3 Use configurable WAL flush inteval 2017-10-03 11:35:38 +01:00
Fabian Reinartz e19b648377 Merge pull request #155 from Gouthamve/level-log
Add levels to all log lines.
2017-10-02 16:34:49 +02:00
Fabian Reinartz 78df406dac Allocate and cache strings for persisted blocks
This change loads the full symbol table when we open a persisted block
and allocates a string for each. This ensures that strings retrieved
through the index can be used after the block was closed.
Before we backed the strings by the mmap'd byte regions which would
segfault in this case.

Also remove an inconsistency in the disk format and move both offset
tables to the end (breaking change).
2017-10-02 15:56:57 +02:00
Goutham Veeramachaneni c521ac495f Merge pull request #152 from criteo-forks/master
Add db.Head() method
2017-09-28 18:10:53 +05:30
Goutham Veeramachaneni c35d3a65bd
Add levels to all log lines.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-09-28 12:49:34 +05:30
Thibault Chataigner 0ff8f91ec8 Add db.Head() method
Signed-off-by: Thibault Chataigner <t.chataigner@criteo.com>
2017-09-25 16:45:24 +02:00
Goutham Veeramachaneni 87c01dd5fb Merge pull request #134 from criteo-forks/master
Expose `Blocks()` on DB
2017-09-25 17:41:25 +05:30
Fabian Reinartz 69f105f4f9 Merge pull request #151 from prometheus/waltrunc
Use boolean function instead of postings to drop WAL series
2017-09-21 15:04:43 +02:00
Fabian Reinartz 1e88ba06b4 Use boolean function instead of postings to drop WAL series
There is not guarantee or requirement for WAL writers to only add
series entries in increasing order of IDs. A postings list cannot look
back and thus unordered WAL entries would skip over IDs to not truncate
from the WAL.
We replace it with a simple boolean check function that does not require
order.
2017-09-21 13:31:01 +02:00
Thibault Chataigner 5ca18837e9 Make DB blocks list public.
This enable computing the first timestamp in the DB
only accessing public interfaces.

Signed-off-by: Thibault Chataigner <t.chataigner@criteo.com>
2017-09-21 11:56:12 +02:00
Fabian Reinartz 5fa1c993b9 Merge pull request #150 from prometheus/postingssort
Ensure postings are always sorted
2017-09-21 09:37:31 +02:00
Fabian Reinartz 6ee254e353 Ensure postings are always sorted
IDs for new series are handed out before the postings are locked. Thus
series are not indexed in order of their IDs, which could result in only
partially sorted postings list.
Iterating over those silently skipped elements as the sort invariant was
violated.
2017-09-21 09:38:18 +02:00
Goutham Veeramachaneni f39388c9af Merge pull request #147 from prometheus/deadlock
Simplify series create logc in head
2017-09-19 19:11:53 +05:30
Fabian Reinartz 162a48e4f2 Create series with ID recorded in WAL when reading it back 2017-09-19 11:31:16 +02:00
Fabian Reinartz 7ada9cd805 Simplify series create logic in head 2017-09-18 12:38:39 +02:00
Goutham Veeramachaneni 2187388292 Merge pull request #146 from prometheus/deadlock
Add missing unlock on early return
2017-09-18 15:02:32 +05:30
Fabian Reinartz ab8d9b9706 Add missing unlock on early return 2017-09-18 11:23:22 +02:00
Fabian Reinartz 99d39174f6 Merge branch 'master' of github.com:prometheus/tsdb 2017-09-18 11:20:45 +02:00
Fabian Reinartz 8214dc82a7 Remove infinite block in benchmark 2017-09-18 11:20:25 +02:00
Fabian Reinartz 643563068b Merge pull request #144 from Gouthamve/misc-
Expose NewIndexReader() and cleanups
2017-09-13 10:23:07 +02:00
Goutham Veeramachaneni 8919baef03
Expose NewIndexReader() and cleanups
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-09-13 13:47:20 +05:30
Fabian Reinartz e45bb1d328 Merge pull request #142 from krasi-georgiev/107-swap-cobra-with-kingpin
replaced cobra with kingpin for the tsdb cli tool
2017-09-12 19:28:35 +02:00
Fabian Reinartz 3870ec285c Merge pull request #140 from prometheus/locks
Fix various races
2017-09-11 10:41:33 +02:00
Fabian Reinartz 3d8be398d6 Merge branch 'locks' of github.com:prometheus/tsdb into locks 2017-09-11 10:39:55 +02:00
Fabian Reinartz 24362567b9 Fix test flakes 2017-09-11 10:33:17 +02:00
Fabian Reinartz 30d29b889c Merge pull request #141 from prometheus/dectmpstr
Fixup allocation regression during compaction
2017-09-11 10:06:49 +02:00
Fabian Reinartz bfe75cec35 Merge pull request #138 from Gouthamve/chunk-compress
Compress the series chunk details in index.
2017-09-11 10:01:42 +02:00
Krasi Georgiev 92d0414993 replaced cobra with kingpin
Signed-off-by: Krasi Georgiev <krasi.root@gmail.com>
2017-09-10 12:35:02 +03:00
Fabian Reinartz b09d90c79c Add decoding method to retrieve unsafe strings
When decoding data from mmaped blocks, we would like to retrieve
a string backed by the mmaped region. As the underlying byte slice
never changes, this is safe.
2017-09-08 18:41:43 +02:00
Fabian Reinartz f904cd385f Do not build a superflous 'all' postings 2017-09-08 18:41:43 +02:00
Fabian Reinartz 6892fc6dcb Finish old WAL segment async, default to no fsync
We were still fsyncing while holding the write lock when we cut a new
segment. Given we cannot do anything but logging errors, we might just
as well complete segments asynchronously.

There's not realistic use case where one would fsync after every WAL
entry, thus make the default of a flush interval of 0 to never fsync
which is a much more likely use case.
2017-09-08 18:41:12 +02:00
Goutham Veeramachaneni afaf12fe45
Compress the series chunk details in index.
Signed-off-by: Goutham Veeramachaneni <cs14btech11014@iith.ac.in>
2017-09-08 20:25:19 +05:30
Fabian Reinartz 1d5f85817d Fix various races 2017-09-08 08:48:19 +02:00