Repository navigation
fix(engine): a dangling vertex reference is a not-found, not a conflict to retry (#6572) - #6576
Conversation
…ct to retry (#6572) getEdgeHeadChunkForWrite wrapped EVERY RecordNotFoundException from its lazy vertex load into the retryable ConcurrentModificationException #5670 invented for a head chunk a concurrent commit has not published yet. When the missing record was the VERTEX itself - reached through an adjacency entry whose target was removed without the entry being disconnected, the documented legacy of a pre-#5670 best-effort edge delete - that was wrong twice over: the type said "retry me" for a record that is gone, so every attempt failed identically and the whole transaction rolled back with no work committed, and the advice named `CHECK DATABASE RECORD <rid> FIX`, whose job is to rebuild the edge list OF the record that no longer exists. The evidence separating the two cases was already on the exception: the RID it names. A missing chunk (or stripe head) really can be the publication window; the vertex the caller asked to modify cannot. When the cause names the vertex's own RID the read now raises VertexNotFoundException - a RecordNotFoundException, deliberately not a NeedRetryException - saying the vertex does not exist and pointing at `CHECK DATABASE FIX`, which sweeps and drops the entries pointing at missing records. The RECORD scope is ruled out in words rather than rendered as a runnable command: the entry to drop lives on the vertex at the other end, and a message that spells out a command with the RID substituted in is one a hurried reader pastes into a console anyway. Everything else keeps the #5670 conflict and the #5764 scoped advice unchanged. Deleting a vertex whose record is already gone therefore stays an ERROR rather than becoming a silent no-op: bucket.deleteRecord answers exactly that for every other record shape, and for this vertex a few steps further down the same delete, so tolerating it here would only hide the corruption. What changes is that the error says what is wrong, and that a caller can tell "this will never work" from "try again" by catching RecordNotFoundException. disconnectEndpoint tolerates the new exception the same way resolveEndpointToDisconnect already tolerates an endpoint that is gone: its existsRecord probe and the head-pointer read are two reads with a gap, so the fact can surface between them. The probe stays - a handle materialised earlier in the transaction answers its head from its own buffer and raises nothing at all - and neither replaces the other. Tests: Issue6572DanglingVertexReferenceTest pins the reported repro, counts that the retry budget is not spent (1 attempt of 3 offered), and RUNS `CHECK DATABASE FIX` to prove the advertised repair is the one that works. The two guard tests keep the chunk case retryable with its scoped advice, and an edge whose endpoint vertex is gone still deletes. Issue5670EdgeDeleteDanglingBackRefTest's headChunkForWrite test pinned the old contract and is corrected in place.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
🟢 Coverage 64.29% diff coverage · -6.54% coverage variation
Metric Results Coverage variation ✅ -6.54% coverage variation Diff coverage ✅ 64.29% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (17baebd) 164623 131671 79.98% Head commit (63ca390) 197022 (+32399) 144690 (+13019) 73.44% (-6.54%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#6576) 14 9 64.29% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Tick the box to add this pull request to the merge queue (same as
|
ReviewI traced this fix through the full call graph ( Correctness
Test coverage
Minor / non-blocking
Nothing else foundNo security concerns (purely internal exception classification), no performance concerns (same number of reads on the hot path, only the exception type differs on an already-exceptional branch), and no dependency/license changes. Well-scoped fix with strong regression coverage - the PR description's engineering rationale checks out against the actual diff. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6576 +/- ##
==========================================
- Coverage 71.29% 71.27% -0.02%
==========================================
Files 1867 1868 +1
Lines 164623 164635 +12
Branches 34794 34795 +1
==========================================
- Hits 117372 117349 -23
- Misses 32993 33031 +38
+ Partials 14258 14255 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes #6572.
The problem
GraphEngine.getEdgeHeadChunkForWritewrapped everyRecordNotFoundExceptionfrom its lazy vertex load into the retryableConcurrentModificationExceptionthat #5670 invented for a head chunk a concurrent commit has not published yet. The reported failure named the same RID in both halves:Single-threaded job, nothing else writing. The vertex was reached through a dangling adjacency entry - one whose target record was removed without the entry being disconnected, the documented legacy of a pre-#5670 best-effort edge delete. Two things were wrong at once, and both hurt a batch job:
CHECK DATABASE RECORD <rid> FIX, which rebuilds the edge list of that record from the surviving edges, while that record is precisely the one that no longer exists.The fix
The evidence separating the two cases was already on the exception: the RID it names. A missing head chunk, mid-chain chunk or stripe head really can be the publication window; the vertex the caller asked to modify cannot.
When the cause names the vertex's own RID, the read now raises the new
VertexNotFoundException- aRecordNotFoundException, deliberately not aNeedRetryException:Everything else keeps the #5670 conflict and the #5764 scoped advice, unchanged.
Two deliberate details:
danglingRepairAdvicealready draws.Deleting a missing vertex stays an error
Asked in the issue, answered here rather than silently: it stays an error, not a tolerated no-op.
bucket.deleteRecordraises not-found for every other record shape - and for this vertex a few steps further down the very same delete - so tolerating it in the graph path alone would relocate the asymmetry while hiding the one thing the caller needs to know.deleteEdge'sALREADY DELETED: IGNORE ITarm is narrower than it reads: it covers only the final physical removal, after both disconnections are done, because a self-loop is walked from both of the vertex's lists and reaches it twice.What changes is that the failure says what is wrong, and that a caller walking possibly-stale references can now tell "this will never work" from "try again" by catching
RecordNotFoundException, and skip the entry instead of losing the batch.One tolerance moves with it:
disconnectEndpointcatches the new exception and treats it as "nothing to disconnect on that side" - the same answerresolveEndpointToDisconnect'sexistsRecordprobe already gives. The probe and the head-pointer read are two reads with a gap, so the same fact can surface between them. The probe stays: a handle materialised earlier in the transaction answers its head pointer from its own buffer and raises nothing at all, so neither check replaces the other.Verification
Issue6572DanglingVertexReferenceTest(5 tests):CHECK DATABASE FIX, then the delete that could not proceed completes andcheck databasereports clean;CHECK DATABASE RECORD <vertex> FIX, and an edge whose endpoint vertex is gone still deletes.Confirmed non-vacuous: 3 of the 5 fail against the unmodified engine.
Issue5670EdgeDeleteDanglingBackRefTest.headChunkForWriteRaisesRetryableConflictWhenTheVertexItselfVanishespinned the old contract and is corrected in place (renamed to...RaisesANonRetryableNotFound...), with the reasoning that led to it rewritten rather than deleted.Green: 326 graph tests (including the
slow-tagged concurrent #5670 rounds), 2946 database + SQL, 4934 openCypher, 186 root-package, full-project compile.Issue6301AlgoSteinerTreeWeightAlignmentTest.anActiveOverlayDoesNotLendItsWeightsToTheWrongEdgesfails on this branch and fails identically onmainwith this change stashed - pre-existing and unrelated.Wire-visible consequence
ErrorCategoryfor this case moves fromRETRYtoNOT_FOUND, so HTTP answers 404 instead of a conflict, and every other protocol its not-found vocabulary. That is the intended verdict: the record does not exist.