mnesia question

Ulf Wiger (AL/EAB) <>
Mon Feb 13 09:48:47 CET 2006

Renyi Xiong wrote:
> 1. what happens if one of (not all of) the RAM replicas of 
> Mnesia table fails when doing write operation? write fails?

If you are using transactions, chances are good that mnesia
will be able to follow through after all. The transaction
is completed as an 'asymmetric' transaction, and the failed
node gets the opportunity to update itself later.

(Of course, assuming that the failed node is not the one 
that initiated the transaction.)

If you're using dirty writes, you may end up with 
database inconsistency. Don't use dirty writes on
replicated tables unless you really really know what
you're doing.

> 2. Is Mnesia table RAM replica distributable across VPN network?

If you can get Distributed Erlang to work, you will be able to 
replicate mnesia tables. Without Distributed Erlang - no replication.

> 3. Is possible to add and remove RAM replica dynamically?

Yes, using the function 

  mnesia:add_table_copy(Tab, Node, Type)

where Type == ram_copies, if it's a RAM replica you want to add.

Removing a replica:

  mnesia:del_table_copy(Tab, Node)

Ulf W

More information about the erlang-questions mailing list