diff --git a/worker/task.go b/worker/task.go index 847ba449985..cf2c967a08c 100644 --- a/worker/task.go +++ b/worker/task.go @@ -357,6 +357,15 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er return nil } + // srcFn.n should be equal to len(q.UidList.Uids) for below implementation(DivideAndRule and + // calculate) to work correctly. But we have seen some panics while forming DataKey in + // calculate(). panic is of the form "index out of range [4] with length 1". Hence return error + // from here when srcFn.n != len(q.UidList.Uids). + if srcFn.n != len(q.UidList.Uids) { + return errors.Errorf("srcFn.n: %d is not equal to len(q.UidList.Uids): %d, srcFn: %+v in "+ + "handleValuePostings", srcFn.n, len(q.UidList.GetUids()), srcFn) + } + // This function has small boilerplate as handleUidPostings, around how the code gets // concurrently executed. I didn't see much value in trying to separate it out, because the core // logic constitutes most of the code volume here.