Skip to content

GraphAnalyticalView: an edge added then deleted within the same overlay window before compaction still shows as a live neighbor #6775

Closed

Description

@robfrank

Summary

DeltaOverlay's added-edge indexes (getAddedOutNeighbors/getAddedInNeighbors, backing GraphAnalyticalView.getNeighborIds/getVertices/isConnectedTo's overlay-added branch) are never filtered against deletedEdgesPerType. An edge created and later deleted, both within the same not-yet-compacted SYNCHRONOUS overlay window, still surfaces as a live neighbor.

Found during review of #6773 (fix for #6769) - a related but distinct defect in the same class, out of scope for that PR since it predates it (the overlay-added path was never deletion-aware, before or after #6769's fix, which only added deletion-count-awareness to the base-CSR-vs-overlay comparison paths: GraphAnalyticalView.copyBaseExcludingDeleted and isConnectedForType).

Reproduction

Confirmed locally against main @ 78e63b0473b74e9aa4c2ff1117eb4ba0d74da343 (pre-#6773 state has the same gap - it is unrelated to that fix):

final GraphAnalyticalView view = GraphAnalyticalView.builder(database)
    .withName("probe").withVertexTypes("N").withEdgeTypes("E")
    .withUpdateMode(GraphAnalyticalView.UpdateMode.SYNCHRONOUS)
    .build();

database.begin();
final MutableVertex c = database.newVertex("N").set("k", "C").save();
final var edge = a.newEdge("E", c).save();
edge.delete();
database.commit();

view.getNeighborIds(idA, Vertex.DIRECTION.OUT, "E"); // returns [idC] - should be []
view.countEdgesBetween(idA, idC, Vertex.DIRECTION.OUT, "E"); // correctly returns -1 (unknown)

countEdgesBetween/countBetweenForType is unaffected - it already returns "unknown" (via isEdgeDeleted) for any pair with a recorded deletion, before it ever looks at overlay-added neighbors, so it degrades safely. getNeighborIds/getVertices/isConnectedTo do not have that guard on the overlay-added branch and report the phantom edge as live.

Suggested direction

DeltaOverlay.getAddedOutNeighbors/getAddedInNeighbors (or their callers in GraphAnalyticalView.getNeighborsFromCSR/isConnectedForType) need to exclude an added neighbor that deletedEdgesPerType/countDeletedEdges also records as deleted for the same pair - conceptually the same run-based exclusion #6769 added for the base CSR side, applied to the overlay-added side too. Since outNeighborIndex/inNeighborIndex are built once per merge() from addedEdgesPerType, the cheapest fix is probably filtering at index-build time rather than per-read.

Related

Activity

  1. added 2 commits that reference this issue on Aug 26, 2026
  2. added a commit that references this issue on Aug 26, 2026
  3. added this to the 26.9.1 milestone on Aug 26, 2026
  4. self-assigned this
    on Aug 26, 2026
  5. added
    in progress
    on Aug 26, 2026
  6. lvca commented on Aug 26, 2026

    @lvca
    Member

    Fixed in #6781, merged to main (7147d06).

    An edge created and then deleted before the view's next compaction used to be recorded as two separate facts: the add stayed in the overlay's added-edge list forever, and the delete was recorded against the pair of vertices. That was wrong twice over. The deleted edge kept showing up as a live neighbour in getVertices/getNeighborIds/isConnectedTo, and the pair-level delete was charged against a different, still-live edge between the same two vertices.

    The overlay now tracks added edges by the edge's own identity, so when the delete arrives it simply withdraws the add instead of recording a deletion for it. The add and the delete cancel, which is what actually happened.

    Two things improve as a side effect:

    • countEdgesBetween() no longer answers "unknown" (a negative value) for a pair the view has deletions for. It returns the exact number of surviving edges, so it now agrees with the neighbour list on the same view instead of contradicting it.
    • Parallel edges are handled correctly throughout: deleting one of several edges between the same two vertices leaves the others visible and counted.

    No action needed on your side, and no API or query syntax changed.


    ❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.

  7. removed
    in progress
    on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions