Repository navigation
Open
Labels
P3Backlog: valid, low payoff-per-effortarea:transactStaging, commit, import/bulk-import, novelty, retraction semanticsenhancementNew feature or requesttriage:needs-decisionBlocked on a product/design decision
Description
A relationship is a reifier on a base edge (s, T, o), and two relationships with the same endpoints and type
share that edge. DELETE r retracts the edge, and the f:reifies* cascade then takes every relationship on it,
so staging refuses a DELETE r whose edge carries more than one relationship
(fluree-db-transact/src/stage.rs, cascade_attachment_retracts, scoped by TxnOpts::relationship_deletes
since #2184):
MATCH (a {id: "a"}), (b {id: "b"}) CREATE (a)-[:K {w: 1}]->(b)
MATCH (a {id: "a"}), (b {id: "b"}) CREATE (a)-[:K {w: 2}]->(b)
MATCH (a)-[r:K {w: 1}]->(b) DELETE r
-- refused: "DELETE of relationship `r` failed: parallel relationships share its underlying edge …"openCypher deletes the one relationship and leaves the other.
Decision needed: what a per-occurrence delete retracts. The plan below assumes "retract the relationship's
reifier (bundle and properties), and the base edge only when no other reifier names it".
Plan:
- Lowering (
lower_cypher_update.rs,lower_delete): forDELETE r, emit the retraction ofr's annotation
subject (its bundle and properties, as the LPG cleanup already reads them) instead of the base-edge template,
and mark the edge as conditionally retracted. - Staging: after the WHERE, for each marked edge, count the reifiers
edge_reifiersfinds that the
transaction does not retract; retract the base edge only when that count is zero.edge_reifiersis already
the one lookup the cascade and the parallel check share, so this adds no second read path. - The parallel refusal then goes away for
DELETE r;DETACH DELETEof a node keeps retracting every edge. - Tests: twin Cypher/SPARQL tests for deleting one of two, both of two (one statement and two), and one of
two beside aSETon the other; the existing refusal tests init_cypher_seq_writes.rsflip to commits. - Perf:
rel_delete_one,rel_delete_allandrel_set_delete_allin the instruction-count harness should not
move; the extra per-edge reifier count is the lookup the cascade already does.
Raised in review of #2184.
Metadata
Metadata
Assignees
Labels
P3Backlog: valid, low payoff-per-effortarea:transactStaging, commit, import/bulk-import, novelty, retraction semanticsenhancementNew feature or requesttriage:needs-decisionBlocked on a product/design decision
Activity