From 497f4b2215e2fc1b6a10c3f96c71b90dbb529eae Mon Sep 17 00:00:00 2001
From: Ulf Wiger
Date: Sun, 30 Jan 2011 20:19:48 +0100
Subject: Add documentation text about majority checking
---
lib/mnesia/doc/src/Mnesia_chap7.xmlsrc | 7 +++++++
lib/mnesia/doc/src/mnesia.xml | 32 +++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 1 deletion(-)
(limited to 'lib/mnesia')
diff --git a/lib/mnesia/doc/src/Mnesia_chap7.xmlsrc b/lib/mnesia/doc/src/Mnesia_chap7.xmlsrc
index 7078499fbf..21174340d1 100644
--- a/lib/mnesia/doc/src/Mnesia_chap7.xmlsrc
+++ b/lib/mnesia/doc/src/Mnesia_chap7.xmlsrc
@@ -473,6 +473,13 @@ dets:close(N).
mnesia:table_info(Tab, master_nodes) may be used to
obtain information about the potential master nodes.
+ Determining which data to keep after communication failure is outside
+ the scope of Mnesia. One approach would be to determine which "island"
+ contains a majority of the nodes. Using the {majority,true} option
+ for critical tables can be a way of ensuring that nodes that are not part
+ of a "majority island" are not able to update those tables. Note that this
+ constitutes a reduction in service on the minority nodes. This would be
+ a tradeoff in favour of higher consistency guarantees.
The function mnesia:force_load_table(Tab) may be used to
force load the table regardless of which table load mechanism
is activated.
diff --git a/lib/mnesia/doc/src/mnesia.xml b/lib/mnesia/doc/src/mnesia.xml
index 16e78ea0af..2a2c7d3a9f 100644
--- a/lib/mnesia/doc/src/mnesia.xml
+++ b/lib/mnesia/doc/src/mnesia.xml
@@ -160,6 +160,14 @@ If a new item is inserted with the same key as
behavior. The default is false.
+ -
+
majority This attribute can be either true or
+ false (default is false). When true, a majority
+ of the table replicas must be available for an update to succeed.
+ Majority checking can be enabled on tables with mission-critical data,
+ where it is vital to avoid inconsistencies due to network splits.
+
+
-
snmp Each (set based) Mnesia table can be
automatically turned into an SNMP ordered table as well.
@@ -649,6 +657,17 @@ mnesia:change_table_copy_type(person, node(), disc_copies)
LoadOrder priority will be loaded first at startup.
+
+ change_table_majority(Tab, Majority) -> {aborted, R} | {atomic, ok}
+ Change the majority check setting for the table.
+
+ Majority must be a boolean; the default is false.
+ When true, a majority of the table's replicas must be available
+ for an update to succeed. When used on fragmented tables, Tab
+ must be the name base table. Directly changing the majority setting on
+ individual fragments is not allowed.
+
+
clear_table(Tab) -> {aborted, R} | {atomic, ok}
Deletes all entries in a table.
@@ -753,6 +772,14 @@ mnesia:change_table_copy_type(person, node(), disc_copies)
priority will be loaded first at startup.
+ -
+
{majority, Flag}, where Flag must be a boolean.
+ If true, any (non-dirty) update to the table will abort unless
+ a majority of the table's replicas are available for the commit.
+ When used on a fragmented table, all fragments will be given
+ the same majority setting.
+
+
-
{ram_copies, Nodelist}, where
Nodelist is a list of the nodes where this table
@@ -1737,7 +1764,10 @@ mnesia:create_table(person,
write and sticky_write are supported.
If the user wants to update the record it is more efficient to
- use write/sticky_write as the LockKind.
+ use write/sticky_write as the LockKind. If majority checking
+ is active on the table, it will be checked as soon as a write lock is
+ attempted. This can be used to quickly abort if the majority condition
+ isn't met.
--
cgit v1.2.3