apoc icon indicating copy to clipboard operation
apoc copied to clipboard

Apoc Trigger in "Phase: After" Never Ends

Open neo-technology-build-agent opened this issue 2 years ago • 5 comments

Issue by leandrogalrinho Thursday Mar 19, 2020 at 16:10 GMT Originally opened as https://github.com/neo4j-contrib/neo4j-apoc-procedures/issues/1453


Hello, I've ran into an unexpected behavior and can't figure out what's the source of it. I'm using apoc 3.5.0.9, and I'm trying to have a trigger in "phase: after" that creates a relationship with the node that has been updated with some other node, but this causes the trigger to never end. However, if the trigger is in "phase: before" it all goes as expected.

Expected Behavior

The trigger is supposed to catch the update event and, after the transaction that updates the _executed property commits, it creates a new relationship with the updated node and a new node.

Actual Behavior

However, unless I terminate the query this never seems to end and will leave the graph in the same state it was before the update, except that the _executed property was indeed updated... But neither the node or the new relation is created.

How to Reproduce the Problem

Simple Dataset

CREATE (:TEST {name:'x', _executed:0});
CREATE (:TEST {name:'y', _executed:0});
CALL apoc.trigger.add('triggerTest','UNWIND apoc.trigger.propertiesByKey({assignedNodeProperties},"_executed") as prop
	WITH prop.node as n
	CREATE (z:SON {father:id(n)})
	CREATE (n)-[:GENERATED]->(z)',
{phase:'after'});

Steps

  1. Insert dataset and trigger into neo4j.
  2. Perform this simple query that updates the _executed property of node x, activating the trigger:
MATCH (a:TEST)
WHERE a.name = 'x'
SET a._executed = a._executed+1

Specifications (Mandatory)

Currently used versions

Versions

  • OS: Windows 8.1
  • Neo4j: 3.5.14 Enterprise
  • Neo4j-Apoc: 3.5.0.9