mnesia replication

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


Hello,

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?

Serge

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

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

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

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

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

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

()6> mnesia:dirty_read(test, 1).
[{test,1,25}]
()2> mnesia:dirty_read(test, 1).
[{test,1,30}]

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

()7> mnesia:dirty_read(test, 1).
[{test,1,30}]
()3> mnesia:dirty_read(test, 1).
[{test,1,25}]

--------
Tables on nodes , and  are out of synch.



More information about the erlang-questions mailing list