From 9651f51c0ceeb9cfd05d0da5217bdcd2e362e5e5 Mon Sep 17 00:00:00 2001 From: Harshil Goel <54325286+harshil-goel@users.noreply.github.com> Date: Sat, 27 Jun 2020 01:49:06 +0530 Subject: [PATCH] fix(dgraph): Badger iterator key copy in count index query (#5689) Use a copy of the key of the badger iterator for count index queries. (cherry picked from commit 7050bfdb5d30191a6967b0f6c68844e225d81db2) --- worker/task.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worker/task.go b/worker/task.go index cf2c967a08c..e0877db9e71 100644 --- a/worker/task.go +++ b/worker/task.go @@ -2174,7 +2174,8 @@ func (qs *queryState) evaluate(cp countParams, out *pb.Result) error { for itr.Seek(countKey); itr.Valid(); itr.Next() { item := itr.Item() - pl, err := qs.cache.Get(item.Key()) + var key []byte + pl, err := qs.cache.Get(item.KeyCopy(key)) if err != nil { return err }