Merge creating duplicate nodes [Neo4j 4.2.2]

Given the following cypher query

MERGE (s:Service{identity:'683b0e50-debf-4e69-b3df-8b22b4068f4c'})
SET = 'myservice'
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})

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,

Use this:
identity:pipeline.polyglotID, name:pipeline.pipelineName

This will create three nodes

Thanks @ameyasoft but that's not the problem.

Maybe I was not very clear. First of all, I apologize for a mistake in the cypher. It happened when I replaced parameters by what actually the query would turn out to be.

Second, I have no issues with creating multiple nodes. The problem is creating duplicate nodes, when this exact query is executed simultaneously by other replicas of the same service. I assumed the MERGE would prevent duplication and it's not.

As mentioned before. I didn't see this behavior with neo 4.1.3. So maybe it's a bug.