Merge pull request #3848 from prometheus/tsdbvendor

vendor: update prometheus/tsdb
pull/3853/head
Fabian Reinartz 7 years ago committed by GitHub
commit 646adff2ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -144,7 +144,11 @@ func NewWriter(fn string) (*Writer, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer df.Close() // close for flatform windows defer df.Close() // Close for platform windows.
if err := os.RemoveAll(fn); err != nil {
return nil, errors.Wrap(err, "remove any existing index at path")
}
f, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY, 0666) f, err := os.OpenFile(fn, os.O_CREATE|os.O_WRONLY, 0666)
if err != nil { if err != nil {
@ -535,8 +539,8 @@ type Reader struct {
c io.Closer c io.Closer
// Cached hashmaps of section offsets. // Cached hashmaps of section offsets.
labels map[string]uint32 labels map[string]uint64
postings map[labels.Label]uint32 postings map[labels.Label]uint64
// Cache of read symbols. Strings that are returned when reading from the // Cache of read symbols. Strings that are returned when reading from the
// block are always backed by true strings held in here rather than // block are always backed by true strings held in here rather than
// strings that are backed by byte slices from the mmap'd index file. This // strings that are backed by byte slices from the mmap'd index file. This
@ -597,8 +601,8 @@ func newReader(b ByteSlice, c io.Closer) (*Reader, error) {
b: b, b: b,
c: c, c: c,
symbols: map[uint32]string{}, symbols: map[uint32]string{},
labels: map[string]uint32{}, labels: map[string]uint64{},
postings: map[labels.Label]uint32{}, postings: map[labels.Label]uint64{},
crc32: newCRC32(), crc32: newCRC32(),
} }
@ -623,7 +627,7 @@ func newReader(b ByteSlice, c io.Closer) (*Reader, error) {
} }
var err error var err error
err = r.readOffsetTable(r.toc.labelIndicesTable, func(key []string, off uint32) error { err = r.readOffsetTable(r.toc.labelIndicesTable, func(key []string, off uint64) error {
if len(key) != 1 { if len(key) != 1 {
return errors.Errorf("unexpected key length %d", len(key)) return errors.Errorf("unexpected key length %d", len(key))
} }
@ -633,7 +637,7 @@ func newReader(b ByteSlice, c io.Closer) (*Reader, error) {
if err != nil { if err != nil {
return nil, errors.Wrap(err, "read label index table") return nil, errors.Wrap(err, "read label index table")
} }
err = r.readOffsetTable(r.toc.postingsTable, func(key []string, off uint32) error { err = r.readOffsetTable(r.toc.postingsTable, func(key []string, off uint64) error {
if len(key) != 2 { if len(key) != 2 {
return errors.Errorf("unexpected key length %d", len(key)) return errors.Errorf("unexpected key length %d", len(key))
} }
@ -786,7 +790,7 @@ func (r *Reader) readSymbols(off int) error {
// readOffsetTable reads an offset table at the given position calls f for each // readOffsetTable reads an offset table at the given position calls f for each
// found entry.f // found entry.f
// If f returns an error it stops decoding and returns the received error, // If f returns an error it stops decoding and returns the received error,
func (r *Reader) readOffsetTable(off uint64, f func([]string, uint32) error) error { func (r *Reader) readOffsetTable(off uint64, f func([]string, uint64) error) error {
d := r.decbufAt(int(off)) d := r.decbufAt(int(off))
cnt := d.be32() cnt := d.be32()
@ -797,7 +801,7 @@ func (r *Reader) readOffsetTable(off uint64, f func([]string, uint32) error) err
for i := 0; i < keyCount; i++ { for i := 0; i < keyCount; i++ {
keys = append(keys, d.uvarintStr()) keys = append(keys, d.uvarintStr())
} }
o := uint32(d.uvarint()) o := d.uvarint64()
if d.err() != nil { if d.err() != nil {
break break
} }

@ -445,7 +445,7 @@ func (rp *removedPostings) Next() bool {
rp.rok = rp.remove.Next() rp.rok = rp.remove.Next()
rp.initialized = true rp.initialized = true
} }
for {
if !rp.fok { if !rp.fok {
return false return false
} }
@ -469,8 +469,7 @@ func (rp *removedPostings) Next() bool {
// Skip the current posting. // Skip the current posting.
rp.fok = rp.full.Next() rp.fok = rp.full.Next()
} }
}
return rp.Next()
} }
func (rp *removedPostings) Seek(id uint64) bool { func (rp *removedPostings) Seek(id uint64) bool {

28
vendor/vendor.json vendored

@ -802,38 +802,38 @@
{ {
"checksumSHA1": "CeD8QwiLL5CBkWMOfbaJxs4AFuM=", "checksumSHA1": "CeD8QwiLL5CBkWMOfbaJxs4AFuM=",
"path": "github.com/prometheus/tsdb", "path": "github.com/prometheus/tsdb",
"revision": "bc49a665d16326ad6ad078b97e0f903d894f80f8", "revision": "494acd307058387ced7646f9996b0f7372eaa558",
"revisionTime": "2018-02-12T10:58:46Z" "revisionTime": "2018-02-15T11:29:47Z"
}, },
{ {
"checksumSHA1": "4X26TfLh8M4WuCFo/5a+Qk+ieSw=", "checksumSHA1": "S7F4yWxVLhxQNHMdgoOo6plmOOs=",
"path": "github.com/prometheus/tsdb/chunkenc", "path": "github.com/prometheus/tsdb/chunkenc",
"revision": "bc49a665d16326ad6ad078b97e0f903d894f80f8", "revision": "494acd307058387ced7646f9996b0f7372eaa558",
"revisionTime": "2018-02-12T10:58:46Z" "revisionTime": "2018-02-15T11:29:47Z"
}, },
{ {
"checksumSHA1": "+zsn1i8cqwgZXL8Bg6jDy32xjAo=", "checksumSHA1": "+zsn1i8cqwgZXL8Bg6jDy32xjAo=",
"path": "github.com/prometheus/tsdb/chunks", "path": "github.com/prometheus/tsdb/chunks",
"revision": "bc49a665d16326ad6ad078b97e0f903d894f80f8", "revision": "494acd307058387ced7646f9996b0f7372eaa558",
"revisionTime": "2018-02-12T10:58:46Z" "revisionTime": "2018-02-15T11:29:47Z"
}, },
{ {
"checksumSHA1": "h49AAcJ5+iRBwCgbfQf+2T1E1ZE=", "checksumSHA1": "h49AAcJ5+iRBwCgbfQf+2T1E1ZE=",
"path": "github.com/prometheus/tsdb/fileutil", "path": "github.com/prometheus/tsdb/fileutil",
"revision": "bc49a665d16326ad6ad078b97e0f903d894f80f8", "revision": "494acd307058387ced7646f9996b0f7372eaa558",
"revisionTime": "2018-02-12T10:58:46Z" "revisionTime": "2018-02-15T11:29:47Z"
}, },
{ {
"checksumSHA1": "Cpumd1FEx22Kz8I3HrhMPrSRPNA=", "checksumSHA1": "UlvN+ZhTu52S8f9niySQpPC+dvQ=",
"path": "github.com/prometheus/tsdb/index", "path": "github.com/prometheus/tsdb/index",
"revision": "bc49a665d16326ad6ad078b97e0f903d894f80f8", "revision": "494acd307058387ced7646f9996b0f7372eaa558",
"revisionTime": "2018-02-12T10:58:46Z" "revisionTime": "2018-02-15T11:29:47Z"
}, },
{ {
"checksumSHA1": "Va8HWvOFTwFeewZFadMAOzNGDps=", "checksumSHA1": "Va8HWvOFTwFeewZFadMAOzNGDps=",
"path": "github.com/prometheus/tsdb/labels", "path": "github.com/prometheus/tsdb/labels",
"revision": "bc49a665d16326ad6ad078b97e0f903d894f80f8", "revision": "494acd307058387ced7646f9996b0f7372eaa558",
"revisionTime": "2018-02-12T10:58:46Z" "revisionTime": "2018-02-15T11:29:47Z"
}, },
{ {
"checksumSHA1": "5SYLEhADhdBVZAGPVHWggQl7H8k=", "checksumSHA1": "5SYLEhADhdBVZAGPVHWggQl7H8k=",

Loading…
Cancel
Save