Commit Graph

41 Commits

Author SHA1 Message Date
Krasi Georgiev 8d86e921cf
refactor block size calculation (#637)
* refactor block size calculation
The block size is kept in memory and not in the meta file anymore.
It now includes the size of the meta file itself for a more
correct block size.
It fixes a bug where the size didn't change when calling `block.Delete()`.
Adds a dedicated test to ensure correct block sizes.
This allows opening a db in a read only mode as it doesn't write to the meta file anymore.

Signed-off-by: Krasi Georgiev <8903888+krasi-georgiev@users.noreply.github.com>
2019-06-24 18:42:29 +03:00
Chris Marchbanks b40cc43958 Provide option to compress WAL records (#609)
In running Prometheus instances, compressing the records was shown to
reduce disk usage by half while incurring a negligible CPU cost.

Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
2019-06-19 16:46:24 +03:00
Krasi Georgiev d48a5e2d5c
Release 0.8.0 (#607)
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-05-17 13:39:03 +03:00
Goutham Veeramachaneni 2ae028114c
Add FromData function (again)! (#600)
Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
2019-05-06 19:17:26 +05:30
Krasi Georgiev 5512826f13
make Close methods for the querier safe to call more than once. (#581)
* make Close methods for the querier safe to call more than once.

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-04-30 10:17:07 +03:00
Brian Brazil c20450564c
Release 0.7.1 (#587)
Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-04-24 13:20:45 +01:00
Krasi Georgiev 4b3a5ac5d3
release 0.7.0 (#580)
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-04-10 14:58:20 +03:00
Brian Brazil 259847a6b1
Be smarter in how we look at matchers. (#572)
* Add unittests for PostingsForMatcher.

* Selector methods are all stateless, don't need a reference.

* Be smarter in how we look at matchers.

Look at all matchers to see if a label can be empty.

Optimise Not handling, so i!="2" is a simple lookup
rather than an inverse postings list.

All all the Withouts together, rather than
having to subtract each from all postings.

Change the pre-expand the postings logic to always do it before doing a
Without only. Don't do that if it's already a list.

The initial goal here was that the oft-seen pattern
i=~"something.+",i!="foo",i!="bar" becomes more efficient.

benchmark                                                            old ns/op     new ns/op     delta
BenchmarkHeadPostingForMatchers/n="1"-4                              5888          6160          +4.62%
BenchmarkHeadPostingForMatchers/n="1",j="foo"-4                      7190          6640          -7.65%
BenchmarkHeadPostingForMatchers/j="foo",n="1"-4                      6038          5923          -1.90%
BenchmarkHeadPostingForMatchers/n="1",j!="foo"-4                     6030884       4850525       -19.57%
BenchmarkHeadPostingForMatchers/i=~".*"-4                            887377940     230329137     -74.04%
BenchmarkHeadPostingForMatchers/i=~".+"-4                            490316101     319931758     -34.75%
BenchmarkHeadPostingForMatchers/i=~""-4                              594961991     130279313     -78.10%
BenchmarkHeadPostingForMatchers/i!=""-4                              537542388     318751015     -40.70%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",j="foo"-4              10460243      8565195       -18.12%
BenchmarkHeadPostingForMatchers/n="1",i=~".*",i!="2",j="foo"-4       44964267      8561546       -80.96%
BenchmarkHeadPostingForMatchers/n="1",i!="",j="foo"-4                42244885      29137737      -31.03%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",j="foo"-4              35285834      32774584      -7.12%
BenchmarkHeadPostingForMatchers/n="1",i=~"1.+",j="foo"-4             8951047       8379024       -6.39%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!="2",j="foo"-4       63813335      30672688      -51.93%
BenchmarkHeadPostingForMatchers/n="1",i=~".+",i!~"2.*",j="foo"-4     45381112      44924397      -1.01%

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-04-09 11:59:45 +01:00
naivewong 7ab060c864 selectOverlappingDirs selects wrong dirs where there are 2 disjoint sets of overlapping dirs
Signed-off-by: naivewong <867245430@qq.com>
2019-04-08 15:27:06 +03:00
Pavel Borzenkov 520b1d858f index: add a test to trigger fd leak on corrupted index (#576)
The test is designed to fail for windows when the function leaves open files.
2019-04-03 11:34:04 +03:00
Krasi Georgiev 8eeb70fee1
remove Fsync workaround for macos. (#574)
since golang 1.12 no special handling is required for file.Sync()

@pborzenkov thanks for the pointer.

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-04-03 11:16:54 +03:00
Pavel Borzenkov 4f204dcbc1 chunks: close all opened MmapFiles on NewDirReader error path (#575)
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2019-04-02 15:16:29 +03:00
Krasi Georgiev e46ec89de6
use fsync to force persisting the meta file. (#573)
* use fsync to force persisting the meta file.

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-04-01 16:23:45 +03:00
Vishnunarayan K I 7757fe6f21 Added ability to create db with NopWal (#519)
Signed-off-by: Vishnunarayan K I <appukuttancr@gmail.com>
2019-03-26 01:38:12 +02:00
zhulongcheng b7cac504c9 Remove unused NewReader function (#547)
The `NewReader` function is not used anywhere.
2019-03-14 15:05:40 +02:00
zhulongcheng 719b57db44 Remove obsolete FromData function (#540)
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-03-06 11:12:28 +02:00
Ganesh Vernekar fcfe312d99
Update CHANGELOG for v0.6.1
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2019-03-05 19:21:46 +05:30
Alec 0861a9b14f [bugfix] update 'last' variable in chunks.MergeOverlappingChunks() (#539)
* update

Signed-off-by: naivewong <867245430@qq.com>

* update comment

Signed-off-by: naivewong <867245430@qq.com>

* Update failing test.

Signed-off-by: naivewong <867245430@qq.com>

* Update comment

Signed-off-by: naivewong <867245430@qq.com>

* Add changelog entry.

Signed-off-by: naivewong <867245430@qq.com>

* Update CHANGELOG.md

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2019-03-05 19:18:55 +05:30
Krasi Georgiev ab8476dd06
Release 0.6.0 (#537) 2019-03-02 15:54:49 +02:00
Krasi Georgiev e78fedf054
release 0.5.0 (#536)
* release 0.5.0

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-03-01 22:57:53 +02:00
Krasi Georgiev df06f9ebc2
update the CHANGELOG with some missing changes. (#535)
missed to add these with some merged PRs

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-02-27 12:55:35 +02:00
Ganesh Vernekar c59ed492b2 Vertical query merging and compaction (#370)
* Vertical series iterator

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Select overlapped blocks first in compactor Plan()

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Added vertical compaction

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Code cleanup and comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix review comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix tests

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Add benchmark for compaction

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Perform vertical compaction only when blocks are overlapping.

Actions for vertical compaction:
* Sorting chunk metas
* Calling chunks.MergeOverlappingChunks on the chunks

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Benchmark for vertical compaction

* BenchmarkNormalCompaction => BenchmarkCompaction
* Moved the benchmark from db_test.go to compact_test.go

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Benchmark for query iterator and seek for non overlapping blocks

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Vertical query merge only for overlapping blocks

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Simplify logging in Compact(...)

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Updated CHANGELOG.md

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Calculate overlapping inside populateBlock

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* MinTime and MaxTime for BlockReader.

Using this to find overlapping blocks in populateBlock()

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Sort blocks w.r.t. MinTime in reload()

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Log about overlapping in LeveledCompactor.write() instead of returning bool

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Log about overlapping inside LeveledCompactor.populateBlock()

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix review comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Refactor createBlock to take optional []Series

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* review1

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>

* Updated CHANGELOG and minor nits

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* nits

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Updated CHANGELOG

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Refactor iterator and seek benchmarks for Querier.

Also has as overlapping blocks.

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Additional test case

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* genSeries takes optional labels. Updated BenchmarkQueryIterator and BenchmarkQuerySeek.

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Split genSeries into genSeries and populateSeries

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Check error in benchmark

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Fix review comments

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>

* Warn about overlapping blocks in reload()

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2019-02-14 14:29:41 +01:00
Krasi Georgiev 2ae0620205 rename some vars and use Gauge instead of Counter for metrics
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-02-07 10:09:42 +02:00
Krasi Georgiev 00d5e19baf Merge remote-tracking branch 'upstream/master' into shutdown-during-compaction
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-01-30 13:47:50 +02:00
Krasi Georgiev a44d15798e
remove a changelog double entry (#507)
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-01-23 17:10:19 +03:00
Brian Brazil 5db162568b Remove _total from prometheus_tsdb_storage_blocks_bytes (#506)
Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2019-01-23 16:46:58 +03:00
Krasi Georgiev 0b31b8af88 Merge remote-tracking branch 'upstream/master' into shutdown-during-compaction
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-01-18 16:58:18 +02:00
Krasi Georgiev 10ba228e6b
release 0.4.0 (#501)
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2019-01-18 11:42:59 +03:00
Ganesh Vernekar 1a9d08adc5 Don't write empty blocks (#374)
* Dont write empty blocks when a compaction results in a block with no samples.

Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2019-01-18 11:35:16 +03:00
Callum Styan 3929359302
add live reader for WAL (#481)
* add live reader for WAL

Signed-off-by: Callum Styan <callumstyan@gmail.com>
2019-01-16 10:09:08 -08:00
mknapphrt ebf5d74325 Added storage size based retention method and new metrics (#343)
Added methods needed to retain data based on a byte limitation rather than time. Limitation is only applied if the flag is set (defaults to 0). Both blocks that are older than the retention period and the blocks that make the size of the storage too large are removed.

2 new metrics for keeping track of the size of the local storage folder and the amount of times data has been deleted because the size restriction was exceeded.
Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
2019-01-16 13:03:52 +03:00
Krasi Georgiev 090b6852e1
remove unused `PrefixMatcher` (#474)
* remove unused `PrefixMatcher`

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-12-28 21:13:02 +03:00
Krasi Georgiev 2e0571caba
remove unused WALFlushInterval option and NopWAL struct (#468)
The WALFlushInterval is not used anywhere in the code base.
The WAL is not an interface anymore to save some lookup time so can't use NopWAL in the tests. Instead can just pass nil as the code checks for that and it is essentially a noop.

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-12-28 20:42:46 +03:00
Brian Brazil 915d7cf937
Add a tsdbutil command to analyse churn etc. (#478)
This reports the cardinality of each label,
the total number of label pairs,
and how much series worth of time is "uncovered"
by series data. Which is basically how much churn there is.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2018-12-28 17:06:12 +00:00
glutamatt 22e3aeb107 Add WALSegmentSize as an option of tsdb creation (#450)
Expose `WALSegmentSize` option to allow overriding the `DefaultOptions.WALSegmentSize`.
2018-12-18 21:56:51 +03:00
Krasi Georgiev 79aa611d56
release 0.3.1 (#477)
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-12-13 17:02:32 +03:00
Krasi Georgiev db127a60e0 changelog
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-12-10 12:48:30 +02:00
Krasi Georgiev bd5ccee5c1 use context to cancel compactions
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-12-10 12:48:30 +02:00
Krasi Georgiev b4a2103a12
Release v0.3.0 (#464) 2018-12-04 16:50:11 +03:00
Krasi Georgiev bac9cbed2e
no overlapping on compaction when an existing block is not within default boundaries. (#461)
closes https://github.com/prometheus/prometheus/issues/4643

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-12-04 13:30:49 +03:00
Krasi Georgiev 48efdf8b81
refactor NewSegmentsRangeReader to take multi WAL ranges (#449)
* refactor NewSegmentsRangeReader to take multi WAL ranges

In case of an error when checkpointing the WAL the error doesn't show
the exact WAL index that is corrupter. this is because it uses
MultiReader to read multiply WAL files.
This refactoring allows the NewSegmentsRangeReader to take more than a
single WAL range and it reads all of the ranges by iterating each one.

this changes the logs from
create checkpoint: read segments: corruption after 4841144384 bytes:...
to
create checkpoint: read segments: corruption in segment
data/wal/00017351 at 123142208: ...

Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
2018-11-30 16:46:16 +02:00