[erlang-questions] Mnesia questions

Ulf Wiger (TN/EAB) <>
Fri Sep 29 16:21:29 CEST 2006

Göran Båge wrote:
> 1. What is a reasonable upper limit of number of table update 
> events for one transaction?

I'm not sure. The transaction store is an ets table, so it's 
not limited per se. Available memory will of course impose
limits, and if the table is replicated, the commit record
with all the updates is sent in one message....
> 2. Is it possible to lock a table outside transactions and if 
> so how is it unlocked?

The only thing I know of is mnesia_controller:block_tab(Tab)
and mnesia_controller:unblock_tab(Tab).

This causes dirty ops to be queued until the table is unblocked.

If you want to block a table spanning several transactions,
I don't know how to do that easily. You could introduce a
critical section of your own, e.g. through the use of 
global:trans(), but this would of course have to be 
honoured by all transactions, always.

Doing it all in one transaction might be preferable,
unless you start running out of memory.

I know that mnesia:transform_table(), when used on 
very large tables, can use a great deal of memory.
A dirty, dirty workaround is to start a transaction,
lock the table, and roll in the updates through dirty
ops. This is dangerous, of course, so your recourse 
might be to reload from backup, if things start 
> 3. Any other advice or pointers? I guess this recovery 
> problem has been addressed by others.

Use '-kernel dist_auto_connect once'
This will keep the nodes from reconnecting spontaneously,
giving you a better chance to resolve the situation in an
orderly fashion.

Ulf W

More information about the erlang-questions mailing list