Chapter 17. Transaction Management
In order to fully maintain data integrity and ensure good transactional behavior, Neo4j supports the ACID properties:
-
atomicity: If any part of a transaction fails, the database state is left unchanged.
-
consistency: Any transaction will leave the database in a consistent state.
-
isolation: During a transaction, modified data cannot be accessed by other operations.
-
durability: The DBMS can always recover the results of a committed transaction.
Specifically:
-
All modifications to Neo4j data must be wrapped in transactions.
-
The default isolation level is
READ_COMMITTED
.
-
Data retrieved by traversals is not protected from modification by other transactions.
-
Non-repeatable reads may occur (i.e., only write locks are acquired and held until the end of the transaction).
-
One can manually acquire write locks on nodes and relationships to achieve higher level of isolation (
SERIALIZABLE
).
-
Locks are acquired at the Node and Relationship level.
-
Deadlock detection is built into the core transaction management.