[erlang-questions] Mnesia k-safetey
Sat Sep 8 11:31:56 CEST 2007
To begin with, you can subscribe to mnesia events.
Race conditions can be avoided by calling
mnesia_schema:schema_transaction/1, and using
the mnesia_schema:do_xxx() functions to rearrange
fragments and copies.
If you want to make sure that only one node reacts
to mnesia events at any given time, gen_leader might
be of some use. You will find it in jungerl.
2007/9/8, James Laken <>:
> Hi All,
> I am trying to implement automatic k-safety with mnesia tables and
> fragments. In this context the k-safety means that each table or
> fragments have at least K number of replica across N number of machines.
> - On node crash each remaining and non-overloaded node should "pick" 1/N
> of the data from the crashed node replicas.
> - On node join, some tables (fragments) replicas migrated to the new
> node, to provide load-balancing.
> At first sight it may looks easy, because Mnesia support online node and
> fragment addition/deletion - but doing it in automatic way, with error
> handling and fault tolerance and without race condition that makes it
> difficult (or at least, to me).
> What is the correct way to implement this kind of setup? Any experience
> or advice?
> erlang-questions mailing list
More information about the erlang-questions