Skip to content

Commit

Permalink
bucket verify: repair out of order labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jjneely committed Mar 22, 2019
1 parent 8e0e4dc commit cb51d71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/thanos/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ func registerBucketVerify(m map[string]setupFunc, root *kingpin.CmdClause, name
var backupBkt objstore.Bucket
if len(backupconfContentYaml) == 0 {
if *repair {
return errors.Wrap(err, "repair is specified, so backup client is required")
return fmt.Errorf("repair is specified, so backup client is required")
}
} else {
backupBkt, err = client.NewBucket(logger, backupconfContentYaml, reg, name)
// nil Prometheus registerer: don't create conflicting metrics
backupBkt, err = client.NewBucket(logger, backupconfContentYaml, nil, name)
if err != nil {
return err
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/block/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,10 @@ func rewrite(
if err := indexr.Series(id, &lset, &chks); err != nil {
return err
}
// Make sure labels are in sorted order
sort.Slice(lset, func(i, j int) bool {
return lset[i].Name < lset[j].Name
})
for i, c := range chks {
chks[i].Chunk, err = chunkr.Chunk(c.Ref)
if err != nil {
Expand Down

0 comments on commit cb51d71

Please sign in to comment.