aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_lib.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2011-05-17 11:57:11 +0200
committerHenrik Nord <[email protected]>2011-05-17 11:57:25 +0200
commit0d2d95e4e3605d31d7032914ed623a91ef01ff25 (patch)
tree5dfe3d43ef6a24df423834fc864e834660c03b71 /lib/mnesia/src/mnesia_lib.erl
parent23db3a53e9c77eee4b1b94bd26c13a9c68718189 (diff)
parent8d7963d76fb651f6cb250033a0a5a643abd01389 (diff)
downloadotp-0d2d95e4e3605d31d7032914ed623a91ef01ff25.tar.gz
otp-0d2d95e4e3605d31d7032914ed623a91ef01ff25.tar.bz2
otp-0d2d95e4e3605d31d7032914ed623a91ef01ff25.zip
Merge branch 'uw/mnesia-majority' into dev
* uw/mnesia-majority: dialyzer warning on mnesia_tm Add documentation text about majority checking add mnesia_majority_test suite where_to_wlock optimization + change_table_majority/2 bug in mnesia_tm:needs_majority/2 optimize sticky_lock maj. check check majority for sticky locks Write locks now check majority when needed. Add {majority, boolean()} per-table option. OTP-9304
Diffstat (limited to 'lib/mnesia/src/mnesia_lib.erl')
-rw-r--r--lib/mnesia/src/mnesia_lib.erl10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/mnesia/src/mnesia_lib.erl b/lib/mnesia/src/mnesia_lib.erl
index 36bcfe8de9..7e926a6258 100644
--- a/lib/mnesia/src/mnesia_lib.erl
+++ b/lib/mnesia/src/mnesia_lib.erl
@@ -96,6 +96,8 @@
exists/1,
fatal/2,
get_node_number/0,
+ have_majority/2,
+ have_majority/3,
fix_error/1,
important/2,
incr_counter/1,
@@ -660,6 +662,14 @@ proc_info(_) -> false.
get_node_number() ->
{node(), self()}.
+have_majority(Tab, HaveNodes) ->
+ have_majority(Tab, val({Tab, all_nodes}), HaveNodes).
+
+have_majority(_Tab, AllNodes, HaveNodes) ->
+ Missing = AllNodes -- HaveNodes,
+ Present = AllNodes -- Missing,
+ length(Present) > length(Missing).
+
read_log_files() ->
[{F, catch file:read_file(F)} || F <- mnesia_log:log_files()].