Given the following cypher query
MERGE (s:Service{identity:'683b0e50-debf-4e69-b3df-8b22b4068f4c'})
SET s.name = 'myservice'
WITH *
UNWIND [{ identity: '94b96bd1-63f1-4f11-876a-d36ddc23d42d', pipelineName: 'pipeline1' }, { identity: '1098ae63-0148-48b7-a3a1-97706c47f8a5', pipelineName: 'pipeline2' }, { identity: 'a17d96f5-53e9-4648-a56b-3cb280f0f252', pipelineName: 'pipeline3' }] as pipeline
MERGE (s)-[:provides]->(p:Pipeline{identity:pipeline.identity})
SET p.name = pipeline.name
WITH *
RETURN p
If it runs in concurrent scenarios, I get the node (p) duplicated. So I have been reading about MERGE creating a write lock, but it doesn't seem to work on non-indexed properties, which is the case.
Our particular scenario prevents us from creating an index for that property at the moment the cypher queries are executed. I wonder if there is any way around this or if there is something I may be missing.
The cypher queries are executed at the same time by kubernetes replicas using latest javascript driver.
- neo4j version: 4.2.2
- neo4j-driver: 4.0.2
- using apoc
Edit: It seem it doesn't happen on 4.1.3 which was the version we were using before.
Edit2: fixed a mistake on the cypher, generated when I replaced parameters with actual values
Thank you for the help.
Best regards,
Fábio