apoc.refactor.cloneNodes() clones survive transaction rollback
Description
When a clone node is made using apoc.refactor.cloneNodes() inside a transaction which is rolled back (manually or automatically), the clone survives the rollback, while other changes made inside the transaction do not. The effect is to break ACID compliance.
Expected Behavior
Clone nodes should vanish with the rest of the transaction changes on rollback.
Actual Behavior
Clone nodes survive as orphans exactly as made out of cloneNodes() (ie without the skipProperties), but without other (subsequent) changes made to them during the transaction.
How to Reproduce the Problem
This Cypher illustrates the fault:
CREATE (original:demo {uid: "original"})
WITH original
CALL apoc.refactor.cloneNodes([original], false, ["uid"])
YIELD input, output AS clone, error // this clone node survives(!)
SET clone.uid = "clone" // however this change doesn't survive
RETURN 1/0 // rollback makes orphans
Steps
- Issue the above Cypher query in an empty DB
- Check that the clone node survived:
MATCH (n) RETURN n
Specifications
Versions Tested
Both versions I have ready access to have the fault.
Enterprise Edition (online sandbox)
- OS: ? (Sandbox)
- Neo4j: 5.16.0 EE
- Neo4j-Apoc: 5.17.0
Community Edition
- OS: Ubuntu 18.04.5 LTS
- Neo4j: 5.10.0 CE
- Neo4j-Apoc: 5.10.0
Hi! thanks for reporting this, we will take a look :)
The fix will be available in 5.18 and 4.4.0.26 :)
Thanks for the fix!