Mnesia Transactions

Evans, Matthew <>
Mon Nov 22 16:47:03 CET 2010


Hi Team,

I have a quick question WRT mnesia and transactions, and can't seem to find the answer anywhere.

Let us say I have a distributed table that is active on several nodes, and wish to apply a transaction to insert multiple records in that table. Is each operation inside that transaction applied individually on each node, or is the whole transaction applied on each node in turn?

For example

ListOfOneThousandRecords = create_records(),
mnesia:transaction(fun() ->
            [mnesia:write(Rec)||Rec<-ListOfOneThousandRecords]
end).

So this transaction will insert 1000 records into the table.

Will mnesia:

1) Take the record in turn and insert it into node1, node2...node X , take the second record and insert into node1, node2...node X until complete.

Or

2) Apply the whole transaction to node1 (insert all 1000 records locally) and then apply the fun (again locally) to node 2 and so on?

Thanks

Matt


More information about the erlang-questions mailing list