Skip to content

Commit

Permalink
Remove pre-sort on label hashing
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo RUTH <[email protected]>
  • Loading branch information
pablo-ruth committed Mar 9, 2022
1 parent 122ca4e commit a8a0542
Showing 1 changed file with 0 additions and 3 deletions.
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 a8a0542

Please sign in to comment.