1

I am performing mix of queries(reads/write/updates/deletes) to a single memgraph instance. To do the same I am using Java client by Neo4j, all the APIs I am currently using are sync APIs from the driver.

Nature of queries in my case is such that I can execute them concurrently with no side effects. For better performance I am firing the queries in parallel. The error I am getting is for a CREATE operation where I am creating an edge between two nodes. This is consistent as I tried running this same setup multiple times and every time, all queries go through except it crashes when it comes to this create edge stage.

Query for reference:

OPTIONAL MATCH (node1) WHERE id(node1) = $nodeId1
OPTIONAL MATCH (node2) WHERE id(node2) = $nodeId2
CREATE (node1)-[:KNOWS]-> (node2)

I am not able to find any documentation around any such error. Please point me to some document like this or any workaround using which I can ask memgraph to put the query on hold if same objects are being operated by some other query.

One approach I am thinking is just implement retry for any such failed queries, but I am looking for a cleaner approach.

P.S. I was running the same setup on Neo4j earlier and did not encounter any problems with it.

Swapnil
  • 806
  • 6
  • 9

1 Answers1

2

Yep, in the case of this error, the code should retry the query. I think an equivalent issue can happen in Neo4j, but since Memgraph is more optimistic about locking, sometimes the error might happen more often. In general, the correct approach is to have error handling for this case implemented.

buda
  • 460
  • 4
  • 8