Don't infinitely loop deduping.

Signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>
pull/13/head
Tom Wilkie 7 years ago
parent 85f8a6df62
commit 8df1489ddc
  1. 2
      pkg/ingester/instance.go
  2. 6
      pkg/querier/iterator.go

@ -58,7 +58,6 @@ func (i *instance) Push(ctx context.Context, req *logproto.PushRequest) error {
}
func (i *instance) Query(req *logproto.QueryRequest, queryServer logproto.Querier_QueryServer) error {
log.Println(req)
matchers, err := parser.Matchers(req.Query)
if err != nil {
return err
@ -67,7 +66,6 @@ func (i *instance) Query(req *logproto.QueryRequest, queryServer logproto.Querie
// TODO: lock smell
i.streamsMtx.Lock()
ids := i.index.lookup(matchers)
log.Printf("matchers: %+v, ids: %+v", matchers, ids)
iterators := make([]querier.EntryIterator, len(ids))
for j := range ids {
stream, ok := i.streams[ids[j]]

@ -145,10 +145,12 @@ func (i *heapIterator) Next() bool {
i.curr = heap.Pop(i.heap).(EntryIterator)
// keep popping entries off if they match, to dedupe
curr := i.curr.Entry()
for i.heap.Len() > 0 {
curr := i.curr.Entry()
next := i.heap.Peek().Entry()
if !curr.Equal(next) {
if curr.Equal(next) {
i.heap.Pop()
} else {
break
}
}

Loading…
Cancel
Save