Search code examples
memgraphdb

Problem with "Cannot resolve conflicting transactions" error in Memgraph


I want to update more that 5000 nodes in regular time intervals (240 seconds). At the moment this means that I'm making a lot of calls concurrently. The problem is that some of them, not all, have the following error:

Neo4jError: Cannot resolve conflicting transactions. You can retry this transaction when the conflicting transaction is finished.

I'm using node and neo4j-driver. I can see that as the result of this error not all data is updated on the graph. I want to ensure that data is correctly updated.

I don't think that the problem is in the code since some transactions are executed, others not. What could I try out to fix this failing transactions?


Solution

  • It might be worth batching all queries into a single one. By default, Memgraph has in-memory transactional storage mode and has snapshot isolation level set to snapshot isolation. It guarantees that all reads made in a transaction will see a consistent snapshot of the database, and the transaction itself will successfully commit only if no updates it has made conflict with any concurrent updates made since that snapshot. If you're sure that your transactions can be committed in random order, and updates to the data will be correct in the end, you can use in-memory analytical storage mode. But, if you decide to do that, please first understand the implications.