mnesia replication

Serge Aleynikov serge@REDACTED
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 \[t2@REDACTED\] \
     -kernel dist_auto_connect once

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

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

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

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

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

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

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

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

--------
Tables on nodes t1@REDACTED, and t2@REDACTED are out of synch.



More information about the erlang-questions mailing list