[erlang-questions] Mnesia Transaction Race Condition

Dan Gudmundsson <>
Thu Oct 25 09:37:30 CEST 2012

Send me a simple example that shows the problem.


On Wed, Oct 24, 2012 at 4:44 PM, Vance Shipley <> wrote:
> I have two mnesia transactions running on two different nodes
> operating on distributed tables.  Some of the time the earlier
> transaction is committed at one node later than the first.  I
> would have thought this wasn't possible.
> The first table is distributed across nodes A & B.
> The second table is distributed across nodes C & D.
> A process on node A performs a transaction which writes to the
> first table and the second table.
> A process on node C, which is guaranteed to begin after the first
> transaction has finished, deletes the object in the second table.
> Perform this 50000 times sequentially and find that the copy of
> the second table on node D contains fifty or so objects which
> should have been deleted in the transaction on node C.
> Tracing with mnesia:set_debug_level/1 reveals that the write from
> the first transaction is being applied after the delete_object of
> the second transaction:
>    Mnesia(): delete_object performed by {tid, 598430, <3388.4769.15>}
>    Mnesia(): write performed by {tid, 598428, <3455.3722.0>}
> What do I have to do to keep the tables consistant?
> Why would tid 598430 be applied before tid 598428 on node D?
> --
>         -Vance
> _______________________________________________
> erlang-questions mailing list
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list