Merge pull request #21 from grafana/reuse-expand-postings-method-in-new-postings-cloner

Use `ExpandPostings()` in `NewPostingsCloner()`
This commit is contained in:
Marco Pracucci 2021-10-13 17:01:24 +02:00 committed by GitHub
commit fbd1b4fb84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -807,11 +807,8 @@ type PostingsCloner struct {
// The instance provided shouldn't have been used before (no Next() calls should have been done)
// and it shouldn't be used once provided to the PostingsCloner.
func NewPostingsCloner(p Postings) *PostingsCloner {
var ids []uint64
for p.Next() {
ids = append(ids, p.At())
}
return &PostingsCloner{ids: ids, err: p.Err()}
ids, err := ExpandPostings(p)
return &PostingsCloner{ids: ids, err: err}
}
// Clone returns another independent Postings instance.