[erlang-questions] Mnesia transactions and error handling good practices

Alexander Lamb <>
Wed Jun 11 21:26:20 CEST 2008


Replying to myself, another option to avoid using several nested  
transactions would be to test in the functions if there is an ongoing  
transaction.
If so, don't create a transaction, if not, create a transaction.
The same kind of logic could be applied by passing a parameter to  
those functions indicating if we need a transaction or not.

Alex

Le 11 juin 08 à 18:35, Ulf Wiger (TN/EAB) a écrit :

> Hynek Vychodil skrev:
>> On Wed, Jun 11, 2008 at 4:38 PM, Daniel Luna <
>> <mailto:>> wrote:
>>
>>    On Wed, 11 Jun 2008, Andreas Hillqvist wrote:
>>> By the way, what is the cost of nested transaction in mnesia?
>>> Would it be "better practice" to keep this archive and set operation
>>> within only on transaction?
>>
>>    The cost of a nested transaction is proportional to the size of  
>> both of
>>    the transactions.
> ...
>> Just check, It means that if outer transaction is loose coupled to  
>> inner
>> (not make intensive data load from inner to outer), there is no  
>> problem
>> with transaction?
>
> No, all the data from the outer transaction is copied into the inner
> transaction, and all the committed data from the inner transaction
> is copied back into the outer.
>
> BR,
> Ulf W
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>




More information about the erlang-questions mailing list