Repository navigation
Description
ArcadeDB 26.8.1 - GraphEngine.getEdgeHeadChunkForWrite reports a dangling edge reference as a retryable conflict, with recovery advice that cannot apply.
What we see in production
A nightly cleanup job that deletes vertices reached through an edge list fails with:
com.arcadedb.exception.ConcurrentModificationException: Edge list OUT of vertex
#98:4138 is not fully visible yet (concurrent commit in flight): Record #98:4138
not found. If it persists once the retries are spent the list is genuinely broken:
run `CHECK DATABASE RECORD #98:4138 FIX` to rebuild its edge list from the
surviving edge records, then retry the delete (the scope saves the vertex passes,
not the edge sweep the rebuild needs)
Note that the vertex named and the record reported missing are THE SAME RID. There is no concurrency involved: the job is single-threaded and nothing else writes that database at that hour. The vertex record genuinely does not exist - the caller reached it through a DANGLING back-reference, i.e. an edge entry on a surviving vertex whose target record was removed without the entry being disconnected.
Why this is a problem
-
The exception type says "retry me" but retrying can never succeed. The record is not transiently invisible, it is gone. Every attempt fails identically, the whole transaction rolls back, and no work at all completes - a single bad reference kills an entire batch job, permanently, every night.
-
The recovery advice is not actionable.
CHECK DATABASE RECORD #98:4138 FIXrebuilds the edge list OF Supported restoring a database from an URL at server startup #98:4138 from surviving edge records - but Supported restoring a database from an URL at server startup #98:4138 is precisely the record that no longer exists. There is nothing to rebuild. The repair actually needed is on the OTHER endpoint: drop the dangling entry that still points at Supported restoring a database from an URL at server startup #98:4138. -
The two cases are indistinguishable to a caller.
vertex RID != missing record RIDreally is "the head chunk is not visible yet / the chain is broken", and the existing message and advice are right for it.vertex RID == missing record RIDis a different fact entirely - "the vertex you asked me to write does not exist" - and deserves its own type and its own message.
Reproduction (plain engine, no concurrency)
final RID aRid, bRid; // a --E1--> b, both plain vertices
// simulate the dangling reference: drop b's record WITHOUT disconnecting the edge
db.transaction(() ->
db.getSchema().getBucketById(bRid.getBucketId()).deleteRecord(bRid, true));
db.transaction(() -> {
for (final Vertex v : db.lookupByRID(aRid, false).asVertex()
.getVertices(Vertex.DIRECTION.OUT, "E1"))
v.delete(); // -> ConcurrentModificationException, same RID in both halves
});The throw is GraphEngine.getEdgeHeadChunkForWrite, from the lazy load of the vertex record that the "head-RID read stays INSIDE the try" comment describes.
What we'd like
Separate the two cases at the point where they are already distinguishable - when the RecordNotFoundException names the VERTEX itself rather than a chunk:
- Raise a non-retryable exception (or plain
RecordNotFoundException) so callers can tell "this will never work" from "try again", instead of burning the retry budget and rolling back a batch. - Say what is actually wrong: the vertex record does not exist, so it was reached through a stale reference.
- Point at a repair that exists.
CHECK DATABASE ... FIXat DATABASE scope can sweep and drop references into missing records; RECORD scope on the missing RID cannot. If the engine can name the referencing endpoint at the throw site, naming it would be even better.
Separately, worth confirming: is deleting a vertex that no longer exists meant to be an error at all, or should it be tolerated the way GraphEngine.deleteEdge already tolerates an already-deleted edge record (catch RecordNotFoundException: ALREADY DELETED: IGNORE IT)? The asymmetry between the two is part of what made this hard to read.
Where the dangling references came from is a separate question we're not asking to answer here - this data predates the #5670/#5680 strictness work, and a pre-#5670 best-effort edge delete leaving a back-reference behind is the documented shape. The ask here is only about how the engine reports meeting one.
Activity
Merge pull request #6576 from ArcadeData/fix/6572-dangling-vertex-ref…
fix(engine): a dangling vertex reference is a not-found, not a confli…
review(#6586): pin the broken-chain opt-in against a missing vertex, …
fix(ArcadeData#6586): one answer for a missing vertex on both sides o…