Skip to content

Commit

Permalink
fix(dgraph): Do not return reverse edges from expandEdges (#7461)
Browse files Browse the repository at this point in the history
We don't need to return reverse edges when we expand the types.
When alpha is running in strict mutations mode and if we try to
delete a node with a type that contains a reverse edge then that
could cause the deletion to fail because the type would be expanded
with the reverse edges.

With this PR, we don't process the reverse edges when processing a type.
Fixes DGRAPH-3057
  • Loading branch information
Ibrahim Jarif authored Feb 22, 2021
1 parent 68ddf63 commit 03e7a1d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions query/mutation.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ func expandEdges(ctx context.Context, m *pb.Mutations) ([]*pb.DirectedEdge, erro
}

for _, pred := range preds {
// Do not return reverse edges.
if x.ParseAttr(pred)[0] == '~' {
continue
}
edgeCopy := *edge
edgeCopy.Attr = pred
edges = append(edges, &edgeCopy)
Expand Down

0 comments on commit 03e7a1d

Please sign in to comment.