From 26a360341a595e4ef7c7963061b44244b72dba21 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Fri, 14 Dec 2018 11:54:26 +0300 Subject: [PATCH] update tsdb to 0.3.1 (#4997) Signed-off-by: Krasi Georgiev --- go.mod | 2 +- go.sum | 4 ++-- vendor/github.com/prometheus/tsdb/.travis.yml | 9 ++++++++- vendor/github.com/prometheus/tsdb/CHANGELOG.md | 4 ++++ vendor/github.com/prometheus/tsdb/head.go | 5 ++--- vendor/github.com/prometheus/tsdb/repair.go | 2 +- vendor/github.com/prometheus/tsdb/wal.go | 2 +- vendor/github.com/prometheus/tsdb/wal/wal.go | 6 +++--- vendor/modules.txt | 2 +- 9 files changed, 23 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index a6dc9b683..33eed11df 100644 --- a/go.mod +++ b/go.mod @@ -88,7 +88,7 @@ require ( github.com/prometheus/client_golang v0.9.1 github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 github.com/prometheus/common v0.0.0-20181119215939-b36ad289a3ea - github.com/prometheus/tsdb v0.3.0 + github.com/prometheus/tsdb v0.3.1 github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect github.com/rlmcpherson/s3gof3r v0.5.0 // indirect github.com/rubyist/circuitbreaker v2.2.1+incompatible // indirect diff --git a/go.sum b/go.sum index 46f30bb40..eba85afa5 100644 --- a/go.sum +++ b/go.sum @@ -209,8 +209,8 @@ github.com/prometheus/common v0.0.0-20181119215939-b36ad289a3ea h1:4RkbEb5XX0Wvu github.com/prometheus/common v0.0.0-20181119215939-b36ad289a3ea/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFdaDqxJVlbOQ1DtGmZWs/Qau0hIlk+WQ= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/tsdb v0.3.0 h1:NQIaA1zfXQWPOWkpfaVBwURsm7nViKLtI3uwYpe8LKs= -github.com/prometheus/tsdb v0.3.0/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/prometheus/tsdb v0.3.1 h1:uGgfubT2MesNpx3T46c5R32RcUoKAPGyWX+4x1orJLE= +github.com/prometheus/tsdb v0.3.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rlmcpherson/s3gof3r v0.5.0 h1:1izOJpTiohSibfOHuNyEA/yQnAirh05enzEdmhez43k= diff --git a/vendor/github.com/prometheus/tsdb/.travis.yml b/vendor/github.com/prometheus/tsdb/.travis.yml index 78fe6858f..c03d14f53 100644 --- a/vendor/github.com/prometheus/tsdb/.travis.yml +++ b/vendor/github.com/prometheus/tsdb/.travis.yml @@ -2,6 +2,10 @@ sudo: required dist: trusty language: go +os: + - windows + - linux + - osx go: - 1.10.x @@ -9,9 +13,12 @@ go: go_import_path: github.com/prometheus/tsdb +before_install: + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install make; fi + install: - go get -v -t ./... script: # `staticcheck` target is omitted due to linting errors - - make check_license style unused test + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then make test; else make check_license style unused test; fi diff --git a/vendor/github.com/prometheus/tsdb/CHANGELOG.md b/vendor/github.com/prometheus/tsdb/CHANGELOG.md index d220de4ce..1f2abce09 100644 --- a/vendor/github.com/prometheus/tsdb/CHANGELOG.md +++ b/vendor/github.com/prometheus/tsdb/CHANGELOG.md @@ -1,5 +1,9 @@ ## master / unreleased + +## 0.3.1 +- [BUGFIX] Fixed most windows test and some actual bugs for unclosed file readers. + ## 0.3.0 - [CHANGE] `LastCheckpoint()` used to return just the segment name and now it returns the full relative path. diff --git a/vendor/github.com/prometheus/tsdb/head.go b/vendor/github.com/prometheus/tsdb/head.go index 52a3dfe46..4d917291a 100644 --- a/vendor/github.com/prometheus/tsdb/head.go +++ b/vendor/github.com/prometheus/tsdb/head.go @@ -473,14 +473,13 @@ func (h *Head) Init(minValidTime int64) error { if err != nil { return errors.Wrap(err, "open WAL segments") } - defer sr.Close() err = h.loadWAL(wal.NewReader(sr)) + sr.Close() // Close the reader so that if there was an error the repair can remove the corrupted file under Windows. if err == nil { return nil } level.Warn(h.logger).Log("msg", "encountered WAL error, attempting repair", "err", err) - if err := h.wal.Repair(err); err != nil { return errors.Wrap(err, "repair corrupted WAL") } @@ -572,7 +571,7 @@ func (h *Head) Truncate(mint int64) (err error) { } // initTime initializes a head with the first timestamp. This only needs to be called -// for a compltely fresh head with an empty WAL. +// for a completely fresh head with an empty WAL. // Returns true if the initialization took an effect. func (h *Head) initTime(t int64) (initialized bool) { if !atomic.CompareAndSwapInt64(&h.minTime, math.MaxInt64, t) { diff --git a/vendor/github.com/prometheus/tsdb/repair.go b/vendor/github.com/prometheus/tsdb/repair.go index fd40cbb5a..15f79d5f7 100644 --- a/vendor/github.com/prometheus/tsdb/repair.go +++ b/vendor/github.com/prometheus/tsdb/repair.go @@ -71,7 +71,7 @@ func repairBadIndexVersion(logger log.Logger, dir string) error { if _, err := io.Copy(repl, broken); err != nil { return wrapErr(err, d) } - // Set the 5th byte to 2 to indiciate the correct file format version. + // Set the 5th byte to 2 to indicate the correct file format version. if _, err := repl.WriteAt([]byte{2}, 4); err != nil { return wrapErr(err, d) } diff --git a/vendor/github.com/prometheus/tsdb/wal.go b/vendor/github.com/prometheus/tsdb/wal.go index 28217639d..684a2fa6a 100644 --- a/vendor/github.com/prometheus/tsdb/wal.go +++ b/vendor/github.com/prometheus/tsdb/wal.go @@ -322,7 +322,7 @@ func (w *SegmentWAL) putBuffer(b *encbuf) { } // Truncate deletes the values prior to mint and the series which the keep function -// does not indiciate to preserve. +// does not indicate to preserve. func (w *SegmentWAL) Truncate(mint int64, keep func(uint64) bool) error { // The last segment is always active. if len(w.files) < 2 { diff --git a/vendor/github.com/prometheus/tsdb/wal/wal.go b/vendor/github.com/prometheus/tsdb/wal/wal.go index 2ed2018c7..5134850fe 100644 --- a/vendor/github.com/prometheus/tsdb/wal/wal.go +++ b/vendor/github.com/prometheus/tsdb/wal/wal.go @@ -298,9 +298,6 @@ func (w *WAL) Repair(origErr error) error { level.Warn(w.logger).Log("msg", "deleting all segments behind corruption", "segment", cerr.Segment) for _, s := range segs { - if s.index <= cerr.Segment { - continue - } if w.segment.i == s.index { // The active segment needs to be removed, // close it first (Windows!). Can be closed safely @@ -310,6 +307,9 @@ func (w *WAL) Repair(origErr error) error { return errors.Wrap(err, "close active segment") } } + if s.index <= cerr.Segment { + continue + } if err := os.Remove(filepath.Join(w.dir, s.name)); err != nil { return errors.Wrapf(err, "delete segment:%v", s.index) } diff --git a/vendor/modules.txt b/vendor/modules.txt index 1373d6db3..49c373979 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -187,7 +187,7 @@ github.com/prometheus/procfs github.com/prometheus/procfs/nfs github.com/prometheus/procfs/xfs github.com/prometheus/procfs/internal/util -# github.com/prometheus/tsdb v0.3.0 +# github.com/prometheus/tsdb v0.3.1 github.com/prometheus/tsdb github.com/prometheus/tsdb/labels github.com/prometheus/tsdb/chunkenc