Mnesia: dirty operations inside transactions

Magnus Henoch <>
Tue Feb 22 10:29:31 CET 2011


Hi all,

I've stumbled upon an apparent contradiction in the Mnesia user manual.

Section 4.3, "Dirty operations", says:

"Even if the following [dirty] functions are executed inside a transaction no locks will be acquired."
http://erlang.org/doc/apps/mnesia/Mnesia_chap4.html#id71370

But section 4.6, "Nested transactions", says:

"It is also possible to mix different activity access contexts while nesting, but the dirty ones (async_dirty,sync_dirty and ets) will inherit the transaction semantics if they are called inside a transaction and thus it will grab locks and use two or three phase commit."

http://erlang.org/doc/apps/mnesia/Mnesia_chap4.html#id72122

So do the dirty functions grab locks or not?

Is there a difference between calling dirty_write etc directly on one hand, and using mnesia:sync_dirty/1 or mnesia:activity/2 on the other hand?

Regards,
Magnus


More information about the erlang-questions mailing list