mnesia replication

Serge Aleynikov <>
Tue Aug 30 17:31:28 CEST 2005


Could someone comment on the effect of short network outages ( < 10-15 
s) on mnesia replication and how to prevent the inconsistency 
demonstrated in the example below?   I intentionally did not alter the 
net_ticktime kernel parameter so that it would be greater than the 
duration of the brief network outage.

I suspect that this might require to architect the database such that 
objects with same keys would always get updated at a specific node, yet 
I wonder if it is possible to have a true master-master mnesia 
replicated database with presence of short network outages?


erl -sname t1 -mnesia extra_db_nodes \[\] \
     -kernel dist_auto_connect once

erl -sname t2 -mnesia extra_db_nodes \[\] \
     -kernel dist_auto_connect once

()1> Nodes = [node(), ].
()2> mnesia:create_schema(Nodes).
()3> rpc:multicall(Nodes, mnesia, start, []).
()4> mnesia:create_table(test, [{disc_copies, Nodes}]).

--> Disconnect the network cable between nettest1 and nettest2. <--

()5> mnesia:dirty_write({test, 1, 25}).
()1> mnesia:dirty_write({test, 1, 30}).

--> Reconnect the network cable between nettest1 and nettest2. <--

()6> mnesia:dirty_read(test, 1).
()2> mnesia:dirty_read(test, 1).

--> Wait for about 5-10 seconds, and repeat the dirty_reads <--

()7> mnesia:dirty_read(test, 1).
()3> mnesia:dirty_read(test, 1).

Tables on nodes , and  are out of synch.

More information about the erlang-questions mailing list