Skip to content

Commit 861d263

Browse files
committed
DOCS-13539: replSetReconfig allows changing one voting member at a time
1 parent 733244e commit 861d263

15 files changed

+333
-210
lines changed

source/includes/extracts-4.4-changes.yaml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ content: |
421421
---
422422
ref: 4.4-replSetGetConfiguration-commitmentStatus
423423
content: |
424-
Starting in MongoDB 4.4, the :dbcommand:`replSetGetConfig` command
424+
The :dbcommand:`replSetGetConfig` command
425425
can specify a new option :ref:`commitmentStatus: true
426426
<replSetGetConfig-commitmentStatus>` when run on the primary. When
427427
run with the option, the command includes in the output a
@@ -446,18 +446,42 @@ content: |
446446
ref: 4.4-replSetReconfig-majority
447447
content: |
448448
449-
Starting in MongoDB 4.4, :dbcommand:`replSetReconfig` waits until a
450-
majority of members install the replica configuration before
451-
returning success. First, the operation waits until the *current*
452-
configuration is committed before installing the *new* configuration
453-
on the primary. The operation then waits until a majority of members
454-
install the *new* configuration before returning successfully.
449+
The :dbcommand:`replSetReconfig` command waits until a majority of
450+
members install the replica configuration before returning success.
451+
First, the operation waits until the *current* configuration is
452+
committed before installing the *new* configuration on the primary.
453+
The operation then waits until a majority of members install the
454+
*new* configuration before returning successfully.
455455
:dbcommand:`replSetReconfig` waits indefinitely by default. MongoDB
456456
4.4 adds the optional :ref:`maxTimeMS
457-
<replSetReconfig-cmd-maxTimeMS>` parameter for specifying the maximum
458-
amount of time to wait for the operation to return successfully. See
459-
:ref:`replSetReconfig-safe-reconfig` for more information on the
460-
reconfiguration process.
457+
<replSetReconfig-cmd-maxTimeMS>` parameter to
458+
:dbcommand:`replSetReconfig` for specifying the maximum amount of
459+
time to wait for the operation to return successfully. See
460+
:ref:`replSetReconfig-cmd-majority-install` for more information.
461+
---
462+
ref: 4.4-replSetReconfig-single-node-voting-change
463+
content: |
464+
465+
The :dbcommand:`replSetReconfig` command allows adding or removing no
466+
more than ``1`` :rsconf:`voting <members[n].votes>` member at a time.
467+
To add or remove multiple voting members, issue a series of
468+
:dbcommand:`replSetReconfig` or :method:`rs.reconfig()` operations to
469+
add or remove one member at a time. See
470+
:ref:`replSetReconfig-cmd-single-node` for more information.
471+
---
472+
ref: 4.4-replSetGetConfig-term-field
473+
content: |
474+
475+
MongoDB 4.4 adds the :rsconf:`term` field to the replica set
476+
:ref:`configuration document <replica-set-configuration-document>`.
477+
Replica set members use :rsconf:`term` and :rsconf:`version` to
478+
achieve consensus on the "newest" replica configuration. Setting
479+
:ref:`featureCompatibilityVersion (fCV) : "4.4" <set-fcv>`
480+
implicitly performs a :dbcommand:`replSetReconfig` to add the
481+
:rsconf:`term` field to the configuration document and blocks until
482+
the new configuration propagates to a majority of replica set
483+
members. Similarly, downgrading to ``fCV : "4.2"`` implicitly
484+
performs a reconfiguration to remove the :rsconf:`term` field.
461485
462486
---
463487
ref: 4.4-changes-migrate-jumbo-chunks
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
ref: replSetReconfig-majority
2+
content: |
3+
4+
Starting in MongoDB 4.4, |reconfig| waits until a majority of replica
5+
set members install the new replica configuration before returning
6+
success. Replica set members propagate their replica configuration
7+
via :ref:`heartbeats <replica-set-heartbeats>`. Whenever a member
8+
learns of a configuration with a higher :rsconf:`version` and
9+
:rsconf:`term`, it installs the new configuration. The
10+
reconfiguration process has two distinct 'waiting' phases:
11+
12+
\1) Wait for the current configuration to be *committed* before installing the new configuration.
13+
The "current" configuration refers to the replica configuration in
14+
use by the primary at the time |reconfig| is issued.
15+
16+
.. _replSetReconfig-configuration-committed:
17+
18+
A configuration is committed when:
19+
20+
- A majority of replica set members have installed the current
21+
configuration, *and*
22+
23+
- All writes which were majority committed in the previous
24+
configuration have also replicated to a majority in the
25+
current configuration.
26+
27+
Typically, the current configuration has already been installed on
28+
a majority of replica set members. However, the majority committed
29+
writes in the previous configuration may not all be committed
30+
in the current configuration. :rsconf:`Delayed
31+
<members[n].slaveDelay>` members *or* members that are
32+
:method:`lagging behind <rs.printSlaveReplicationInfo()>` the
33+
primary can increase the time spent in this phase.
34+
35+
If the operation was issued with a
36+
|reconfig-maxTimeMS| limit *and*
37+
the operation exceeds the limit while waiting, the operation
38+
returns an error and discard the new configuration. The
39+
limit is *cumulative* and does not reset after proceeding to
40+
the next phase.
41+
42+
\2) Wait for a majority of members in the new configuration to install the new configuration.
43+
The "new" configuration refers to the replica configuration
44+
specified to |reconfig|.
45+
46+
The primary installs and begins using the new replica
47+
configuration before propagating the configuration to the
48+
remaining replica set members. The operation only waits for
49+
a majority of members to install the new configuration, and does
50+
not require waiting for the new configuration to be
51+
:ref:`committed <replSetReconfig-configuration-committed>`.
52+
53+
If the operation was issued with a |reconfig-maxTimeMS| limit
54+
*and* the operation exceeds the limit while waiting, the operation
55+
returns an error *but* continues using and propagating the new
56+
configuration.
57+
58+
Issuing a |reconfig-force| reconfiguration
59+
immediately installs the new configuration regardless of the
60+
commitment status of the previous configuration. Force
61+
reconfiguration can cause unexpected behavior, such as the
62+
rollback of :writeconcern:`"majority"` committed write operations.
63+
64+
To check the commitment status of the current replica configuration,
65+
issue :dbcommand:`replSetGetConfig` with the
66+
:ref:`commitmentStatus <replSetGetConfig-commitmentStatus>` parameter
67+
on the replica set :term:`primary`.
68+
69+
---
70+
ref: replSetReconfig-single-node
71+
content: |
72+
73+
Starting in MongoDB 4.4, |reconfig| by default allows adding or
74+
removing no more than ``1`` :rsconf:`voting <members[n].votes>`
75+
member at a time. For example, a new configuration can make at most
76+
*one* of the following changes to the cluster :rsconf:`membership
77+
<members[n].votes>`:
78+
79+
- Adding a new voting replica set member.
80+
81+
- Removing an existing voting replica set member.
82+
83+
- Modifying the :rsconf:`~members[n].votes` for an existing replica
84+
set member.
85+
86+
To add or remove multiple voting members, issue a series of
87+
|reconfig| operations to add or remove one member at a
88+
time.
89+
90+
Issuing a |reconfig-force| reconfiguration
91+
immediately installs the new configuration even if it adds or removes
92+
multiple voting members. Force reconfiguration can cause unexpected
93+
behavior, such as the rollback of :writeconcern:`"majority"`
94+
committed write operations.
95+
96+
...
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Non-voting members must have :rsconf:`~members[n].priority` of 0.
1+
Non-voting (i.e. :rsconf:`~members[n].votes` is ``0``) members must have
2+
:rsconf:`~members[n].priority` of 0.

source/includes/steps-4.4-upgrade-replica-set.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ action:
5858
code: |
5959
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
6060
post: |
61+
62+
Setting :ref:`featureCompatibilityVersion (fCV) : "4.4" <set-fcv>`
63+
implicitly performs a :dbcommand:`replSetReconfig` to add the
64+
:rsconf:`term` field to the configuration document and blocks
65+
until the new configuration propagates to a majority of replica
66+
set members.
67+
6168
This command must perform writes to an internal system
6269
collection. If for any reason the command does not complete
6370
successfully, you can safely retry the command on the primary as

source/includes/steps-4.4-upgrade-sharded-cluster.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,12 @@ content: |
286286
287287
db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } )
288288
289+
Setting :ref:`featureCompatibilityVersion (fCV) : "4.4" <set-fcv>`
290+
implicitly performs a :dbcommand:`replSetReconfig` on each shard to
291+
add the :rsconf:`term` field to the shard replica configuration
292+
document and blocks until the new configuration propagates to a
293+
majority of replica set members.
294+
289295
This command must perform writes to an internal system collection.
290296
If for any reason the command does not complete successfully, you
291297
can safely retry the command on the :binary:`~bin.mongos` as the

source/reference/command/replSetReconfig.txt

Lines changed: 21 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ replSetReconfig
5959
replica configuration to propagate to a majority of replica
6060
set members. Setting ``maxTimeMS`` may result
6161
in the operation failing *before* it can apply the new
62-
configuration. See :ref:`replSetReconfig-safe-reconfig`
62+
configuration. See :ref:`replSetReconfig-cmd-majority-install`
6363
for more information.
6464

6565
.. versionadded:: 4.4
@@ -72,78 +72,32 @@ replSetReconfig
7272
Behavior
7373
--------
7474

75+
``term`` Replica Configuration Field
76+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77+
7578
MongoDB 4.4 adds the :rsconf:`term` field to the replica set
7679
configuration document. The :rsconf:`term` field is set by the
7780
:term:`primary` replica set member. The primary ignores the
7881
:rsconf:`term` field if set explicitly in the
7982
:dbcommand:`replSetReconfig` operation.
8083

81-
.. _replSetReconfig-safe-reconfig:
82-
83-
Safe Replica Set Reconfiguration
84-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85-
86-
Starting in MongoDB 4.4, :dbcommand:`replSetReconfig` waits until a
87-
majority of replica set members install the new replica configuration
88-
before returning success. Replica set members propagate their replica
89-
configuration via :ref:`heartbeats <replica-set-heartbeats>`. Whenever a
90-
member learns of a configuration with a higher :rsconf:`version` and
91-
:rsconf:`term`, it accepts and installs the new configuration. The
92-
reconfiguration process has two distinct 'waiting' phases:
93-
94-
\1) Wait for the current configuration to be *committed* before installing the new configuration.
95-
The "current" configuration refers to the replica configuration in use
96-
by the primary at the time :dbcommand:`replSetReconfig` is issued.
97-
98-
The current configuration is *committed* when:
99-
100-
- A majority of replica set members have installed the current
101-
configuration, *and*
102-
103-
- All writes which were majority committed in the previous
104-
configuration have also replicated to a majority in the
105-
current configuration.
106-
107-
The current configuration has typically already been installed on a
108-
majority of replica set members and does not require additional
109-
waiting. The operation *may* wait a significant amount of time for a
110-
majority of replica members to commit specific oplog entries.
111-
:rsconf:`Delayed <members[n].slaveDelay>` members *or* members that
112-
are :method:`lagging behind <rs.printSlaveReplicationInfo()>`
113-
the primary can increase the time spent in this phase.
114-
115-
If the operation was issued with a
116-
:ref:`maxTimeMS <replSetReconfig-cmd-maxTimeMS>` limit *and*
117-
the operation exceeds the limit while waiting,
118-
return an error and discard the new configuration. The
119-
limit is *cumulative* and does not reset after proceeding to
120-
the next phase.
121-
122-
\2) Wait for a majority of members in the new configuration to install the new configuration.
123-
The "new" configuration refers to the replica configuration
124-
specified to :dbcommand:`replSetReconfig`.
125-
126-
The primary installs and begins using the new replica
127-
configuration before propagating the configuration to the
128-
remaining replica set members. The operation only waits for
129-
a majority of members to install the new configuration, and does
130-
not require waiting for the new configuration to be *committed*.
131-
132-
If the operation was issued with a :ref:`maxTimeMS
133-
<replSetReconfig-cmd-maxTimeMS>` limit *and* the operation
134-
exceeds the limit while waiting, return an error *but* continue
135-
using and propagating the new configuration.
136-
137-
Issuing a :ref:`force <replSetReconfig-cmd-force>` reconfiguration
138-
immediately installs the new configuration regardless of the commitment
139-
status of the previous configuration. Force reconfiguration can cause
140-
unexpected behavior, such as the rollback of :writeconcern:`"majority"`
141-
committed write operations.
142-
143-
To check the commitment status of the current replica configuration,
144-
issue :dbcommand:`replSetGetConfig` with the
145-
:ref:`commitmentStatus <replSetGetConfig-commitmentStatus>` parameter
146-
on the replica set :term:`primary`. (*New in 4.4*)
84+
.. |reconfig| replace:: :dbcommand:`replSetReconfig`
85+
.. |reconfig-force| replace:: :ref:`force <replSetReconfig-cmd-force>`
86+
.. |reconfig-maxTimeMS| replace:: :ref:`maxTimeMS <replSetReconfig-cmd-maxTimeMS>`
87+
88+
.. _replSetReconfig-cmd-single-node:
89+
90+
Reconfiguration Can Add or Remove No More than One Voting Member at a Time
91+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92+
93+
.. include:: /includes/extracts/replSetReconfig-single-node.rst
94+
95+
.. _replSetReconfig-cmd-majority-install:
96+
97+
Reconfiguration Waits Until a Majority of Members Install the Replica Configuration
98+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99+
100+
.. include:: /includes/extracts/replSetReconfig-majority.rst
147101

148102
Access Control
149103
~~~~~~~~~~~~~~

source/reference/method/rs.reconfig.txt

Lines changed: 20 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -96,78 +96,32 @@ Definition
9696
Behavior
9797
--------
9898

99+
``term`` Replica Configuration Field
100+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
101+
99102
MongoDB 4.4 adds the :rsconf:`term` field to the replica set
100103
configuration document. The :rsconf:`term` field is set by the
101104
:term:`primary` replica set member. The primary ignores the
102105
:rsconf:`term` field if set explicitly in the
103106
:method:`rs.reconfig()` operation.
104107

105-
.. _rs-reconfig-safe-reconfig:
106-
107-
Safe Replica Set Reconfiguration
108-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109-
110-
Starting in MongoDB 4.4, :method:`rs.reconfig()` waits until a
111-
majority of replica set members install the new replica configuration
112-
before returning success. Replica set members propagate their replica
113-
configuration via :ref:`heartbeats <replica-set-heartbeats>`. Whenever a
114-
member learns of a configuration with a higher :rsconf:`version` and
115-
:rsconf:`term`, it accepts and installs the new configuration. The
116-
reconfiguration process has two distinct 'waiting' phases:
117-
118-
\1) Wait for the current configuration to be *committed* before installing the new configuration.
119-
The "current" configuration refers to the replica configuration in use
120-
by the primary at the time :method:`rs.reconfig()` is issued.
121-
122-
The current configuration is committed when:
123-
124-
- A majority of replica set members have installed the current
125-
configuration, *and*
126-
127-
- All writes which were majority committed in the previous
128-
configuration have also replicated to a majority in the
129-
current configuration.
130-
131-
The current configuration has typically already been installed on a
132-
majority of replica set members and does not require additional
133-
waiting. The operation *may* wait a significant amount of time for a
134-
majority of replica members to commit specific oplog entries.
135-
:rsconf:`Delayed <members[n].slaveDelay>` members *or* members that
136-
are :method:`lagging behind <rs.printSlaveReplicationInfo()>`
137-
the primary can increase the time spent in this phase.
138-
139-
If the operation was issued with a
140-
:ref:`maxTimeMS <rs-reconfig-method-maxTimeMS>` limit *and*
141-
the operation exceeds the limit while waiting,
142-
return an error and discard the new configuration. The
143-
limit is *cumulative* and does not reset after proceeding to
144-
the next phase.
145-
146-
\2) Wait for a majority of members in the new configuration to install the new configuration.
147-
The "new" configuration refers to the replica configuration
148-
specified to :method:`rs.reconfig()`.
149-
150-
The primary installs and begins using the new replica
151-
configuration before propagating the configuration to the
152-
remaining replica set members. The operation only waits for
153-
a majority of members to install the new configuration, and does
154-
not require waiting for the new configuration to be *committed*.
155-
156-
If the operation was issued with a :ref:`maxTimeMS
157-
<rs-reconfig-method-maxTimeMS>` limit *and* the operation
158-
exceeds the limit while waiting, return an error *but* continue
159-
using and propagating the new configuration.
160-
161-
Issuing a :ref:`force <rs-reconfig-method-force>` reconfiguration
162-
immediately installs the new configuration regardless of the commitment
163-
status of the previous configuration. Force reconfiguration can cause
164-
unexpected behavior, such as the rollback of :writeconcern:`"majority"`
165-
committed write operations.
166-
167-
To check the commitment status of the current replica configuration,
168-
issue :dbcommand:`replSetGetConfig` with the
169-
:ref:`commitmentStatus <replSetGetConfig-commitmentStatus>` parameter
170-
on the replica set :term:`primary`. (*New in 4.4*)
108+
.. |reconfig| replace:: :method:`rs.reconfig()`
109+
.. |reconfig-force| replace:: :ref:`force <rs-reconfig-method-force>`
110+
.. |reconfig-maxTimeMS| replace:: :ref:`maxTimeMS <rs-reconfig-method-maxTimeMS>`
111+
112+
.. _rs-reconfig-single-node:
113+
114+
Reconfiguration Can Add or Remove No More than One Voting Member at a Time
115+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
116+
117+
.. include:: /includes/extracts/replSetReconfig-single-node.rst
118+
119+
.. _rs-reconfig-majority-install:
120+
121+
Reconfiguration Waits Until a Majority of Members Install the Replica Configuration
122+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123+
124+
.. include:: /includes/extracts/replSetReconfig-majority.rst
171125

172126
Access Control
173127
~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)