Skip to content

Commit

Permalink
Throw errors returned by retrieveValuesAndFacets (#4966)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
martinmr committed Mar 18, 2020
1 parent 3ab8fbd commit cb174f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion worker/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,11 @@ func (qs *queryState) handleValuePostings(ctx context.Context, args funcArgs) er

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

0 comments on commit cb174f4

Please sign in to comment.