Skip to content

Transaction management - 3. Default locking behavior  #19

Open
@ivanruski

Description

@ivanruski

Hello,
I am using Neo4j v4.3.10 and according to the docs:

When creating or deleting a relationship a write lock will be taken on the specific relationship and both its nodes.

However I am observing different behavior when deleting a relationship between 2 nodes.

Steps to reproduce:

  1. Run the following query:
MATCH (t:Thing{uuid:"tosho"})
MATCH (g:Thing{uuid:"gosho"})
MERGE (t)-[fr:FRIEND]->(g)
  1. Then
MATCH (t:Thing{uuid:"tosho"})
MATCH (g:Thing{uuid:"gosho"})
MATCH (t)-[fr:FRIEND]->(g)
DELETE fr
WITH t call apoc.util.sleep(200000) RETURN t;
  1. Then, find the transaction's queryId
call dbms.listTransactions()
  1. List the active locks for that query
call dbms.listActiveLocks('query-xxxx')

I am seeing only one EXCLUSIVE lock for the relationship.
"EXCLUSIVE"│"RELATIONSHIP_DELETE" │115762891

The rest of the locks are shared, whereas I am expecting to see 3 EXCLUSIVE locks according to the docs - one for the relationship and 2 for the nodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions