Michael Shuck
Michael Shuck

Reputation: 21

Do nested transactions have any effect on locking

begin tx1
    do some work
    begin tx2
      do some work
    tx2.success
    tx2.finish
tx1.success
tx1.finish

does tx2.finish actually commit or release locks?

thanks

Upvotes: 2

Views: 247

Answers (1)

Aravind Yarram
Aravind Yarram

Reputation: 80176

Neo4j has the notion of flat nested transactions. Flat nested transactions means that all nested transactions are added to the scope of the top level transaction. So in your case tx2 can mark the entire transaction for rollback and Neo4j will rollback both tx1 and tx2. In your case only tx1.finish will commit the transaction.

All modifications within a Neo4j's transactions are kept in memory until commit or rollback. Locks are then obtained to do the actual flush. So in your case tx1.finish is when the locks are obtained.

Read this section of the Neo4j manual for more information.

Upvotes: 3

Related Questions