You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A Graph Analytical View's dense node ids can exceed getNodeCount() once a base vertex is deleted, so algo.* silently drops nodes #6792
Raised in review of PR #6788 (issue #6315), verified to be independent of it.
What happens
GraphAnalyticalView.getNodeCount() answers DeltaOverlay.getTotalNodeCount() while an overlay is active: baseNodeCount - deletedBase + overflowCount - deletedOverflow. The dense id space is not renumbered to
match. Delete one base vertex and the surviving vertices keep the ids they had, so the largest live id is now nodeCount or more.
AbstractAlgoProcedure.GraphData sizes every array from that count and iterates 0..nodeCount-1, so:
a live vertex whose id landed above the count is never visited - it is silently absent from the answer
of every algo.* procedure, which is a wrong result with no exception;
a neighbour id above the count indexes out of the arrays - AlgoAPSP's dist[i][j] and AlgoMaxFlow's capacity[i][j] are the two that index by neighbour rather than only iterating, so an ArrayIndexOutOfBoundsException is reachable in principle.
Reproduced on fix/6315-edge-property-overlay-resolution with a three-vertex graph (A, B, SPARE), a SYNCHRONOUS view with compaction disabled, SPARE deleted and one vertex added:
nodeCount=2
A=2 out=[1] in=[] <- id 2 with a node count of 2: A is never iterated
B=1 out=[0] in=[2] <- and B reports a neighbour that indexes past every array
FRESH=0
Checked deliberately, because that PR gave the weighted columnar path a new way to produce these ids. It is
not the source: the same run with the view materialising no edge property columns - which sends the same
procedure down weightedAdjacencyFromRecords instead, the path that existed before - produces byte-identical
ids and the same answer. getNeighborIds has always served overlay ids, and getNodeId has always resolved
them, so every path into GraphData could already carry one.
What it would take
Either the id space or the count has to move, and they are not equally cheap:
renumber on every overlay change - correct, and defeats the point of an overlay;
make getNodeCount() the id-space bound rather than the live-vertex count, i.e. answer baseNodeCount + overflowCount, and let the deleted ids be holes the callers already have to tolerate
(getRID answers null for them, and GraphData.getVertex already skips a null). This looks closest to
what the callers assume, but getNodeCount() is public API and its current answer is the honest one for
anyone asking "how many vertices are in this view";
have GraphData size itself from the id space and keep getNodeCount() meaning what it says, which
needs a second accessor for the bound.
The third is the one that changes no existing meaning. Worth a regression test that walks every algo.*
procedure over a view with both a deleted base vertex and an added one.
Activity
fix(ArcadeData#6792): renumber a view's node ids for algo.*, and keep…
fix(#6792): separate GAV node count from ID bound
Merge pull request #6887 from justinblethrow-cloud/fix/6792-gav-id-sp…
fix(ArcadeData#6976,ArcadeData#6791): reject unknown algo direction s…
test: consolidate the Issue*Test classes of the other openCypher sub-…
test: consolidate the Issue*Test classes of the other openCypher sub-…