diff options
author | Ulf Wiger <[email protected]> | 2010-12-09 18:14:15 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-05-16 11:00:28 +0200 |
commit | 38eef7af0f8bc1d2d152cefb8df1e1303ddcac45 (patch) | |
tree | d9c59098037eafa221a08efaa085933e8915c127 /lib/mnesia/src/mnesia_tm.erl | |
parent | 6d446fc5d08d56174a79ab546d5aa2e79277af06 (diff) | |
download | otp-38eef7af0f8bc1d2d152cefb8df1e1303ddcac45.tar.gz otp-38eef7af0f8bc1d2d152cefb8df1e1303ddcac45.tar.bz2 otp-38eef7af0f8bc1d2d152cefb8df1e1303ddcac45.zip |
Write locks now check majority when needed.
Since the table loader also sets (table) write locks, a special
lock type, 'load', was needed. Unfortunately, this affects mnesia
activity callbacks that redefine the lock operation.
Diffstat (limited to 'lib/mnesia/src/mnesia_tm.erl')
-rw-r--r-- | lib/mnesia/src/mnesia_tm.erl | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/mnesia/src/mnesia_tm.erl b/lib/mnesia/src/mnesia_tm.erl index c7a0c28589..0b87c40add 100644 --- a/lib/mnesia/src/mnesia_tm.erl +++ b/lib/mnesia/src/mnesia_tm.erl @@ -1259,23 +1259,15 @@ needs_majority(Tab, #prep{majority = M}) -> false -> [{Tab, []} | M]; true -> - CopyHolders = all_copy_holders(Tab), + CopyHolders = val({Tab, all_nodes}), [{Tab, CopyHolders} | M] end end. -all_copy_holders(Tab) -> - DC = val({Tab, disc_copies}), - DO = val({Tab, disc_only_copies}), - RC = val({Tab, ram_copies}), - DC ++ DO ++ RC. - have_majority([], _) -> ok; have_majority([{Tab, AllNodes} | Rest], Nodes) -> - Missing = AllNodes -- Nodes, - Present = AllNodes -- Missing, - case length(Present) > length(Missing) of + case mnesia_lib:have_majority(Tab, AllNodes, Nodes) of true -> have_majority(Rest, Nodes); false -> |