Skip to content

graph_batch: refuse an edge endpoint that is not an existing vertex (27.1.1) - #543

Open
tae898 wants to merge 1 commit into
mainfrom
fix/506-graph-batch-rid-endpoints
Open

tae898 wants to merge 1 commit into
mainfrom
fix/506-graph-batch-rid-endpoints

Conversation

@tae898

@tae898 tae898 commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

graph_batch() in both packages now refuses an edge endpoint that is not an existing vertex, before it buffers any edge of the call, and names the RID. A refused call buffers nothing and the batch stays usable. A RID of no record raises RecordNotFoundError, and a RID of a document or an edge raises ArcadeDBError.

Please do not merge yet. I still have to decide whether this goes into 26.12.1.

I reproduced the failure on main (CI-built arcadedb-jvm wheel): one batch of 9 edges between 10 new vertices, one of them with a bad endpoint. new_edge and new_edges gave the same result, nothing was refused when the edge was buffered, and close() raised:

Bad endpoint Edge records left Reachable by out() Reachable by in() Error at close()
missing destination 9 0 0 RecordNotFoundError
missing source 0 0 0 RecordNotFoundError
unknown bucket 9 0 0 RecordNotFoundError
document destination 9 0 0 ClassCastException
document source 9 8 8 ClassCastException

What changes for a caller: a call with a bad endpoint raises at once instead of at flush() or close(). An endpoint that does not exist yet when the edge is buffered (for example one that another thread has not committed) is now refused too. A vertex deleted between the call and the flush is still not caught.

The check is the one GraphBatch.requireVertex makes in engine 26.12.1. It is written in the bindings because pull request builds of the native package link 26.11.1, which does not have that method.

Related issues

Closes #506

Performance changes

The check adds one record lookup and one type lookup for each endpoint of each edge, with no cache. I will add the timed A/B result as a comment once CI has built the wheels, and it should be read before any merge.

Docs

how-to/bulk-loads.adoc (new section "Edge endpoints in a graph batch") and the docstrings of new_edge and new_edges.

Checklist

  • A regression test fails on the old code and passes on the new (tests/test_graph_batch_bad_endpoints.py, runs on both packages)
  • The test suite that the change can affect passes (see the checks)
  • uvx pre-commit run --files <changed files> passes

…before the call buffers anything

GraphBatch.newEdge() takes its endpoints on trust. A RID of no record, or of a document, failed only at flush or close, after the edge records were written, and then no vertex led to the edges of the load. Both builds now check every endpoint before the first edge of a call is buffered: EdgeBatcher on the JVM build, NativeExtras (and a check_endpoints op) on the native one. The check is the one the engine's requireVertex makes; it is written here because the native build also links 26.11.1, which does not have that method.
@tae898 tae898 added bug Something isn't working python Pull requests that update python code native The arcadedb package (native library build) jvm The arcadedb-jvm package (JPype build) labels Nov 29, 2026
@tae898 tae898 self-assigned this Nov 29, 2026
tae898 added a commit that referenced this pull request Nov 30, 2026
…ed error subclass; to_json() text per build (#549)

#543 and #544 are held for the 26.12.1 decision, so the pages state the
behaviour without them, each with a REMOVE WHEN comment. The which-package
table gains the to_json() row of #545/#546 and points to to_json_list().
@tae898 tae898 mentioned this pull request Nov 30, 2026
1 of 10 tasks
@tae898 tae898 added this to the 27.1.1 milestone Nov 30, 2026
@tae898

tae898 commented Nov 30, 2026

Copy link
Copy Markdown
Collaborator Author

Decided on 2026-11-30, as the current decision and open to change: this stays out of 26.12.1 and moves to 27.1.1, with #506. I set the milestone. It rests on what the change does to callers: a bad endpoint raises at the call instead of at flush() or close(), an endpoint that is not committed yet is refused too, and the cost of the extra lookups per endpoint is not measured. The hold on merging stands, and the timed A/B result comes before any merge.

@tae898 tae898 changed the title graph_batch: refuse an edge endpoint that is not an existing vertex (hold: 26.12.1 decision) graph_batch: refuse an edge endpoint that is not an existing vertex (27.1.1) Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working jvm The arcadedb-jvm package (JPype build) native The arcadedb package (native library build) python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

graph_batch accepts an edge to a RID that does not exist or is not a vertex, which can leave the whole load unreachable

1 participant