cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Acquisition of shared read locks

Neo4j allows acquisition of shared read locks on nodes and edges by using org.neo4j.graphdb.Transaction::acquireReadLock. Since this functionality is not available via Cypher, according to https://neo4j.com/docs/java-reference/current/transaction-management/isolation/, a workaround is for readers to perform an otherwise useless write in order to implicitly acquire a write lock, preventing any concurrent writers from modifying the node. However, this also locks out all other concurrent writers.
Is there any other way, besides, org.neo4j.graphdb.Transaction::acquireReadLock, for acquiring a shared read lock on a node?

1 ACCEPTED SOLUTION

APOC to the resuce!
You could use CALL apoc.lock.read.nodes(<list of nodes>) or CALL apoc.lock.read.rels(<list of rels>). Standard cypher does not provide any way to acquire read locks.

View solution in original post

1 REPLY 1

APOC to the resuce!
You could use CALL apoc.lock.read.nodes(<list of nodes>) or CALL apoc.lock.read.rels(<list of rels>). Standard cypher does not provide any way to acquire read locks.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online