Skip to content

Commit

Permalink
receive: remove sort on label hashing (#5224)
Browse files Browse the repository at this point in the history
* Remove pre-sort on label hashing

Signed-off-by: Pablo RUTH <contact@pablo-ruth.fr>

* Add CHANGELOG entry

Signed-off-by: Pablo RUTH <contact@pablo-ruth.fr>
  • Loading branch information
pablo-ruth authored Mar 9, 2022
1 parent 122ca4e commit 3026e58
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#5205](https://github.com/thanos-io/thanos/pull/5205) Rule: Add ruler labels as external labels in stateless ruler mode.
- [#5206](https://github.com/thanos-io/thanos/pull/5206) Cache: add timeout for groupcache's fetch operation.
- [#5218](https://github.com/thanos-io/thanos/pull/5218) Tools: Run bucket downsample tools continuously.
- [#5224](https://github.com/thanos-io/thanos/pull/5224) Receive: Remove sort on label hashing

### Removed

Expand Down
3 changes: 0 additions & 3 deletions pkg/receive/hashring.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package receive
import (
"context"
"fmt"
"sort"
"sync"

"github.com/pkg/errors"
Expand Down Expand Up @@ -67,8 +66,6 @@ func (s simpleHashring) GetN(tenant string, ts *prompb.TimeSeries, n uint64) (st
return "", &insufficientNodesError{have: uint64(len(s)), want: n + 1}
}

sort.Slice(ts.Labels, func(i, j int) bool { return ts.Labels[i].Name < ts.Labels[j].Name })

return s[(labelpb.HashWithPrefix(tenant, ts.Labels)+n)%uint64(len(s))], nil
}

Expand Down

0 comments on commit 3026e58

Please sign in to comment.