patch: majority checking in mnesia

Ulf Wiger <>
Mon Jan 31 01:45:02 CET 2011

git fetch :uwiger/otp.git mnesia-majority

    Add {majority, boolean()} per-table option.
    With {majority, true} set for a table, write transactions will
    abort if they cannot commit to a majority of the nodes that
    have a copy of the table. Currently, the implementation hooks
    into the prepare_commit, and forces an asymmetric transaction
    if the commit set affects any table with the majority flag set.
    In the commit itself, the transaction will abort if it cannot
    satisfy the majority requirement for all tables involved in the

I've added test cases to the mnesia test suite, run the full suite
without errors, and updated the documentation.

I've kept the commits separate, as some concerns were raised about 
majority checking in the locker. I believe I managed to optimise away
practically all overhead involved in performing this check. When
benchmarking, I could not notice any difference in cost, measured on
a transaction that did 500 reads using write locks.

Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.

More information about the erlang-patches mailing list