neo4j-apoc-procedures icon indicating copy to clipboard operation
neo4j-apoc-procedures copied to clipboard

apoc.refactor.cloneNodes() clones survive transaction rollback

Open aubsartre opened this issue 1 year ago • 1 comments

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

  1. Issue the above Cypher query in an empty DB
  2. 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

aubsartre avatar Feb 23 '24 17:02 aubsartre

Hi! thanks for reporting this, we will take a look :)

gem-neo4j avatar Feb 26 '24 11:02 gem-neo4j

The fix will be available in 5.18 and 4.4.0.26 :)

gem-neo4j avatar Mar 04 '24 08:03 gem-neo4j

Thanks for the fix!

aubsartre avatar Mar 04 '24 15:03 aubsartre