Skip to content

Commit 62daa11

Browse files
author
Dave Cuthbert
authored
DOCS-15411 commit quorum v write concern (#2009)
* DOCS-15411 commitQuorum-and-writeConcerns * DOCS-15411 commitQuorum-and-writeConcerns * Staging fixes * Staging fixes * Review feedback * Staging fixes * Review Feedback * Review Feedback * Review feedback * Review feedback * Staging fixes * Review feedback * Review feedback * Commit feedback
1 parent 3264b9f commit 62daa11

File tree

10 files changed

+103
-28
lines changed

10 files changed

+103
-28
lines changed

source/core/index-creation.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ index build, use the :dbcommand:`setIndexCommitQuorum` command.
226226
- For rolling index builds on sharded clusters, see
227227
:doc:`/tutorial/build-indexes-on-sharded-clusters`.
228228

229+
Commit Quorum Contrasted with Write Concern
230+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231+
232+
.. include:: /includes/indexes/commit-quorum-vs-write-concern.rst
233+
229234
.. _index-operations-build-failure:
230235

231236
Build Failure and Recovery
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
There are important differences between :ref:`commit quorums
2+
<createIndexes-cmd-commitQuorum>` and :ref:`write concerns
3+
<write-concern>`:
4+
5+
- Index builds use **commit quorums**.
6+
- Write operations use **write concerns**.
7+
8+
Each data-bearing node in a cluster is a voting member.
9+
10+
The **commit quorum** specifies how many data-bearing voting members, or
11+
which voting members, including the primary, must be prepared to commit
12+
a :ref:`simultaneous index build <index-operations-simultaneous-build>`.
13+
before the primary will execute the commit.
14+
15+
The **write concern** is the level of acknowledgement that the write has
16+
propagated to the specified number of instances.
17+
18+
The **commit quorum** specifies how many nodes must be *ready* to finish
19+
the index build before the primary commits the index build. In contrast,
20+
when the primary has committed the index build, the **write concern**
21+
specifies how many nodes must *finish* the index build before the
22+
command returns.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Index creation is a :ref:`multistage process <index-build-process>`.
2+
Starting in MongoDB 4.4, the index creation process uses the ``commit
3+
quorum`` to minimize replication lag on secondary nodes.
4+
5+
When a secondary node receives a ``commitIndexBuild`` oplog entry, the
6+
node stops further oplog applications until the local index build can be
7+
committed. Index builds can take anywhere from moments to days to
8+
complete, so the replication lag can be significant if the secondary
9+
node builds more slowly than the primary.
10+
11+
To manage the replication lag, the commit quorum delays committing the
12+
index build on the primary node until a minimum number of secondaries
13+
are also ready to commit the index build.
14+
15+
The commit quorum does not guarantee that indexes on secondaries are
16+
ready for use when the command completes. To ensure that a specific
17+
number of secondaries are ready for use, set an appropriate :ref:`write
18+
concern <write-concern>`.
19+
20+
If a secondary node that is not included in the commit quorum receives
21+
a ``commitIndexBuild`` oplog entry, the node may block replication until
22+
its index build is complete.
23+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
To set the :ref:`commit quorum <createIndexes-cmd-commitQuorum>`, use
2+
|updateMethod-name| to specify the ``commitQuorum`` value.
3+
4+
``commitQuorum`` specifies how many data-bearing voting members, or
5+
which voting members, including the primary, must be prepared to commit
6+
the index build before the primary will execute the commit. The default
7+
commit quorum is ``votingMembers``, which means all data-bearing
8+
members.

source/reference/command/createIndexes.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ createIndexes
77
.. contents:: On this page
88
:local:
99
:backlinks: none
10-
:depth: 1
10+
:depth: 2
1111
:class: singlecol
1212

1313
Definition
@@ -730,6 +730,11 @@ Transactions
730730
.. |operation| replace:: :dbcommand:`createIndexes`
731731

732732

733+
Commit Quorum Contrasted with Write Concern
734+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
735+
736+
.. include:: /includes/indexes/commit-quorum-vs-write-concern.rst
737+
733738
Example
734739
-------
735740

@@ -991,12 +996,8 @@ Create Index With Commit Quorum
991996

992997
.. include:: /includes/extracts/4.4-changes-index-builds-simultaneous.rst
993998

994-
Specify the :ref:`commitQuorum <createIndexes-cmd-commitQuorum>` option
995-
to the :dbcommand:`createIndexes` operation to set the minimum
996-
number of data-bearing voting members (i.e commit quorum), including the
997-
primary, which must complete the index build before the
998-
primary marks the indexes as ready. The default commit quorum is
999-
``votingMembers``, or all data-bearing replica set members.
999+
.. |updateMethod-name| replace:: :dbcommand:`createIndexes`
1000+
.. include:: /includes/indexes/template-commit-quorum-intro.rst
10001001

10011002
The following operation creates an index with a :ref:`commit quorum
10021003
<createIndexes-cmd-commitQuorum>` of ``"majority"``, or a

source/reference/command/setIndexCommitQuorum.txt

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@ setIndexCommitQuorum
1414

1515
.. dbcommand:: setIndexCommitQuorum
1616

17-
Changes the minimum number of data-bearing members (i.e commit
18-
quorum), including the primary, that must complete an in-progress
19-
:ref:`simultaneous index build <index-operations-simultaneous-build>`
20-
before the primary marks those indexes as ready.
17+
The ``setIndexCommitQuorum`` command sets minimum number of
18+
data-bearing members that must be prepared to commit their local
19+
index builds before the primary node will commit the index.
2120

2221
Syntax
2322
------
@@ -81,8 +80,9 @@ The command takes the following fields:
8180
:ref:`interrupted index builds <index-operations-build-failure>`
8281
when the commit quorum is set to ``"votingMembers"``.
8382

84-
Replica set nodes in a commit quorum must have :rsconf:`members[n].buildIndexes`
85-
set to ``true``. If any voting nodes have ``members[n].buildIndexes``
83+
To update the commitQuorum, member replica set nodes must have
84+
:rsconf:`members[n].buildIndexes` set to ``true``. If any voting
85+
nodes have ``members[n].buildIndexes``
8686
set to ``false``, you can't use the default ``"votingMembers"`` commit
8787
quorum. Either configure all nodes with ``members[n].buildIndexes``
8888
set to ``true``, or select a different commit quorum.
@@ -116,6 +116,8 @@ Behavior
116116

117117
.. include:: /includes/extracts/4.4-changes-index-builds-simultaneous-fcv.rst
118118

119+
.. include:: /includes/indexes/commit-quorum.rst
120+
119121
Issuing :dbcommand:`setIndexCommitQuorum` has no effect on index builds
120122
started with :ref:`commitQuorum <createIndexes-cmd-commitQuorum>` of
121123
``0``.
@@ -125,6 +127,14 @@ started with :ref:`commitQuorum <createIndexes-cmd-commitQuorum>` of
125127
Replica set nodes with :ref:`buildIndexes <replica-set-configuration-buildIndexes>`
126128
set to ``false`` can't be included in a commit quorum.
127129

130+
.. _commit-quorum-contrasted-with-write-concern:
131+
132+
Commit Quorum Contrasted with Write Concern
133+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134+
135+
.. include:: /includes/indexes/commit-quorum-vs-write-concern.rst
136+
137+
128138
Examples
129139
--------
130140

source/reference/glossary.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ Glossary
193193
indexes. See :doc:`/core/query-optimization` for details about
194194
query execution strategies.
195195

196+
commit quorum
197+
During an :ref:`index build <index-operations-replicated-build>`
198+
the :ref:`commit quorum <createIndexes-cmd-commitQuorum>`
199+
specifies how many secondaries must be ready to commit their local
200+
index build before the primary node will execute the commit.
201+
196202
compound index
197203
An :term:`index` consisting of two or more keys. See
198204
:ref:`index-type-compound`.

source/reference/method/db.collection.createIndex.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ db.collection.createIndex()
99
.. contents:: On this page
1010
:local:
1111
:backlinks: none
12-
:depth: 1
12+
:depth: 2
1313
:class: singlecol
1414

1515
Definition
@@ -1008,13 +1008,8 @@ Create Index With Commit Quorum
10081008

10091009
.. include:: /includes/extracts/4.4-changes-index-builds-simultaneous.rst
10101010

1011-
Specify the :ref:`commitQuorum <createIndex-method-commitQuorum>`
1012-
parameter to the :method:`~db.collection.createIndex()` operation to set
1013-
the minimum number of data-bearing voting members (i.e commit
1014-
quorum), including the primary, which must complete the
1015-
index build before the primary marks the indexes as ready. The default
1016-
commit quorum is ``votingMembers``, or all data-bearing voting replica
1017-
set members.
1011+
.. |updateMethod-name| replace:: :method:`~db.collection.createIndex()`
1012+
.. include:: /includes/indexes/template-commit-quorum-intro.rst
10181013

10191014
The following operation creates an index with a :ref:`commit quorum
10201015
<createIndex-method-commitQuorum>` of ``"majority"``, or a

source/reference/method/db.collection.createIndexes.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ db.collection.createIndexes()
77
.. contents:: On this page
88
:local:
99
:backlinks: none
10-
:depth: 1
10+
:depth: 2
1111
:class: singlecol
1212

1313
Definition
@@ -1004,12 +1004,8 @@ Create Indexes With Commit Quorum
10041004

10051005
.. include:: /includes/extracts/4.4-changes-index-builds-simultaneous.rst
10061006

1007-
Specify the :ref:`commitQuorum <createIndexes-method-commitQuorum>`
1008-
parameter to the :method:`~db.collection.createIndexes` operation to set
1009-
the minimum number of data-bearing voting members (i.e commit
1010-
quorum), including the primary, which must complete the index build
1011-
before the primary marks the indexes as ready. The default commit quorum
1012-
is ``votingMembers``, or all data-bearing voting replica set members.
1007+
.. |updateMethod-name| replace:: :method:`~db.collection.createIndexes()`
1008+
.. include:: /includes/indexes/template-commit-quorum-intro.rst
10131009

10141010
The following operation creates an index with a :ref:`commit quorum
10151011
<createIndexes-method-commitQuorum>` of ``"majority"``:

source/reference/write-concern.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,12 @@ The following table shows the possible write concern ``provenance``
488488
values and their significance:
489489

490490
.. include:: /includes/fact-wc-provenance-table.rst
491+
492+
493+
.. _write-concern-contrasted-with-commit-quorum:
494+
495+
Write Concern Contrasted with Commit Quorum
496+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
497+
498+
.. include:: /includes/indexes/commit-quorum-vs-write-concern.rst
499+

0 commit comments

Comments
 (0)