mnesia question

Hakan Mattsson hakan@REDACTED
Mon Feb 20 09:55:37 CET 2006

On Fri, 17 Feb 2006, Renyi Xiong wrote:

RX> That's wonderful.
RX> Since I don't wait for participants to complete their job (except local
RX> node?) if I use 'mnesia:transaction/1' instead of
RX> 'mnesia:sync_transaction/1',  plus Mnesia put transaction logs onto disk
RX> even if database is RAM based (right?), RAM based database in this case
RX> (multiple replicas using 'mnesia:transaction/1') doesn't make much
RX> difference, is that right?

No, if the database is RAM based there will be no
writes to disk at all. In that case the transaction
recovery algortithm will rely on that some replica of
all (important) tables always will be accessible. A
power outage will vipe out the entire RAM database.

Neither 'mnesia:transaction/1' nor 'mnesia:sync_transaction/1'
ensures that the disk cache is flushed into durable storage.
So if you are unlucky the transaction may be lost in both
types of transactions. The worst scenario is when you get
a power outage on all nodes directly after a transaction
commit. In that case the plain 'mnesia:transaction/1' would
have a little higher probability to be lost. 

But remember that both 'mnesia:transaction/1' and
'mnesia:sync_transaction/1' are always atomic. So even
if you loose a committed transaction the database will
remain consistent.


More information about the erlang-questions mailing list