Skip to content

Commit c44e7e1

Browse files
authored
Throw errors returned by retrieveValuesAndFacets (#4966)
The error was being ignored and an empty response was being written because the condition in a case statement didn't exclude errors not equal to nil or ErrNoValue. This caused reads below the rollup Ts to succeed with an empty response when they should throw an error. The bug was triggered by running Jepsen tests with incremental rollups enabled. Fixes #4958
1 parent 9da6077 commit c44e7e1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

worker/task.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,11 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er
401401

402402
vals, fcs, err := retrieveValuesAndFacets(args, pl, facetsTree, listType)
403403
switch {
404-
case err == posting.ErrNoValue || len(vals) == 0:
404+
case err == posting.ErrNoValue || (err == nil && len(vals) == 0):
405+
// This branch is taken when the value does not exist in the pl or
406+
// the number of values retreived is zero (there could still be facets).
407+
// We add empty lists to the UidMatrix, FaceMatrix, ValueMatrix and
408+
// LangMatrix so that all these data structure have predicatble layouts.
405409
out.UidMatrix = append(out.UidMatrix, &pb.List{})
406410
out.FacetMatrix = append(out.FacetMatrix, &pb.FacetsList{})
407411
out.ValueMatrix = append(out.ValueMatrix,

0 commit comments

Comments
 (0)