@ -21,6 +21,7 @@ import (
"sync"
"sync"
"github.com/pkg/errors"
"github.com/pkg/errors"
"golang.org/x/exp/slices"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/prometheus/prometheus/storage"
@ -239,11 +240,9 @@ func (p *MemPostings) EnsureOrder() {
for i := 0 ; i < n ; i ++ {
for i := 0 ; i < n ; i ++ {
go func ( ) {
go func ( ) {
var sortable seriesRefSlice
for job := range workc {
for job := range workc {
for _ , l := range * job {
for _ , l := range * job {
sortable = l
slices . Sort ( l )
sort . Sort ( & sortable )
}
}
* job = ( * job ) [ : 0 ]
* job = ( * job ) [ : 0 ]
@ -830,13 +829,6 @@ func (it *bigEndianPostings) Err() error {
return nil
return nil
}
}
// seriesRefSlice attaches the methods of sort.Interface to []storage.SeriesRef, sorting in increasing order.
type seriesRefSlice [ ] storage . SeriesRef
func ( x seriesRefSlice ) Len ( ) int { return len ( x ) }
func ( x seriesRefSlice ) Less ( i , j int ) bool { return x [ i ] < x [ j ] }
func ( x seriesRefSlice ) Swap ( i , j int ) { x [ i ] , x [ j ] = x [ j ] , x [ i ] }
// FindIntersectingPostings checks the intersection of p and candidates[i] for each i in candidates,
// FindIntersectingPostings checks the intersection of p and candidates[i] for each i in candidates,
// if intersection is non empty, then i is added to the indexes returned.
// if intersection is non empty, then i is added to the indexes returned.
// Returned indexes are not sorted.
// Returned indexes are not sorted.