Skip to content

Commit

Permalink
Fix bug for queries with @recurse and expand(_all_). (#3179)
Browse files Browse the repository at this point in the history
Currently this type of queries might result in an unrecoverable error
in the alpha. This happens for example, while trying to expand on a node
of type PASSWORD.

The reason is that handleValuePostings and handleUidPostings sometimes
successfully return early without setting the UidMatrix field.

This change adds a fix and modifies the existing test to trigger this
case. I have verified that the test crashes the alpha when the fix is
absent.

(cherry picked from commit 3081fc1)
- Removed common_test.go conflict
- Removed sg.UnknownAttr check that's only in master.
  • Loading branch information
martinmr authored and danielmai committed Apr 12, 2019
1 parent afef15e commit 83d2ffc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions query/recurse.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ func (start *SubGraph) expandRecurse(ctx context.Context, maxDepth uint64) error
}

for _, sg := range exec {
// sg.uidMatrix can be empty. Continue if that is the case.
if len(sg.uidMatrix) == 0 {
continue
}

if len(sg.Filters) > 0 {
// We need to do this in case we had some filters.
sg.updateUidMatrix()
Expand Down

0 comments on commit 83d2ffc

Please sign in to comment.