Skip to content

Commit 093a307

Browse files
committed
DOCS-13460: 4.4 replSetGetConfig commitmentStatus
1 parent 358643d commit 093a307

File tree

4 files changed

+202
-13
lines changed

4 files changed

+202
-13
lines changed

source/includes/extracts-4.4-changes.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,4 +427,15 @@ content: |
427427
any replica set member where :rsconf:`members[n].votes` is greater
428428
than ``0``. For sharded clusters, the index build occurs only on
429429
shards containing data for the collection being indexed.
430+
---
431+
ref: 4.4-replSetGetConfiguration-commitmentStatus
432+
content: |
433+
Starting in MongoDB 4.4, the :dbcommand:`replSetGetConfig` command
434+
can specify a new option :ref:`commitmentStatus: true
435+
<replSetGetConfig-commitmentStatus>` when run on the primary. When
436+
run with the option, the command includes in the output a
437+
:ref:`commitmentStatus <replSetGetConfig-output-commitmentStatus>`
438+
field. This output field indicates whether the replica set's
439+
previous reconfig has been committed, so that the replica set is
440+
ready to be reconfigured again. |moreinfo|
430441
...

source/reference/command/replSetGetConfig.txt

Lines changed: 176 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,193 @@ Definition
1515

1616
.. dbcommand:: replSetGetConfig
1717

18-
Returns a document that describes the current configuration of the
19-
:term:`replica set`. To invoke the command directly, use the
20-
following operation:
18+
Returns a document that describes the current :ref:`configuration
19+
<replica-set-configuration-document>` of the :term:`replica set`.
2120

22-
.. code-block:: javascript
21+
Syntax
22+
------
2323

24-
db.runCommand( { replSetGetConfig: 1 } );
24+
To run, :dbcommand:`replSetGetConfig` must be issued against the
25+
``admin`` database and has the following syntax:
2526

26-
In the :binary:`~bin.mongo` shell, you can access the data provided by
27-
:dbcommand:`replSetGetConfig` using the :method:`rs.conf()` method,
28-
as in the following:
27+
.. code-block:: javascript
2928

30-
.. code-block:: javascript
29+
db.adminCommand( {
30+
replSetGetConfig: 1,
31+
commitmentStatus: <boolean> // Available starting in MongoDB 4.4
32+
} );
3133

32-
rs.conf();
34+
.. list-table::
35+
:header-rows: 1
36+
:widths: 20 15 65
37+
38+
* - Field
39+
- Type
40+
- Description
41+
42+
* - ``replSetGetConfig``
43+
- any
44+
- Any value
45+
46+
* - :ref:`commitmentStatus <replSetGetConfig-commitmentStatus>`
47+
48+
- boolean
49+
50+
- .. _replSetGetConfig-commitmentStatus:
51+
52+
Optional. Specify ``true`` to include a :ref:`commitmentStatus
53+
<replSetGetConfig-output-commitmentStatus>` field in the output.
54+
The :ref:`commitmentStatus
55+
<replSetGetConfig-output-commitmentStatus>` output field
56+
indicates whether the replica set's previous reconfig has been
57+
committed, so that the replica set is ready to be reconfigured
58+
again. For details, see :ref:`commitmentStatus Output Field
59+
<replSetGetConfig-output-commitmentStatus>`.
60+
61+
You can only specify ``commitmentStatus: true`` option when
62+
running the command on the primary. The command errors if run
63+
with ``commitmentStatus: true`` on a secondary.
64+
65+
.. versionadded:: 4.4
66+
67+
The :binary:`~bin.mongo` shell provides the :method:`rs.conf()` method
68+
that wraps the :dbcommand:`replSetGetConfig` command:
69+
70+
.. code-block:: javascript
71+
72+
rs.conf();
3373

3474
.. _replSetGetConfig-example:
3575

3676
Output Example
3777
--------------
3878

39-
.. include:: /includes/replica-set-conf-document-output.rst
79+
The following is an example output of the :dbcommand:`replSetGetConfig`
80+
command run with :ref:`commitmentStatus: true
81+
<replSetGetConfig-commitmentStatus>` on the primary:
82+
83+
.. code-block:: javascript
84+
85+
{
86+
"config" : {
87+
"_id" : "myRepl",
88+
"version" : 180294,
89+
"term" : 1,
90+
"protocolVersion" : NumberLong(1),
91+
"writeConcernMajorityJournalDefault" : true,
92+
"members" : [
93+
{
94+
"_id" : 0,
95+
"host" : "m1.example.net:27017",
96+
"arbiterOnly" : false,
97+
"buildIndexes" : true,
98+
"hidden" : false,
99+
"priority" : 1,
100+
"tags" : {
101+
102+
},
103+
"slaveDelay" : NumberLong(0),
104+
"votes" : 1
105+
},
106+
{
107+
"_id" : 1,
108+
"host" : "m2.example.net:27017",
109+
"arbiterOnly" : false,
110+
"buildIndexes" : true,
111+
"hidden" : false,
112+
"priority" : 1,
113+
"tags" : {
114+
115+
},
116+
"slaveDelay" : NumberLong(0),
117+
"votes" : 1
118+
},
119+
{
120+
"_id" : 2,
121+
"host" : "m3.example.net:27017",
122+
"arbiterOnly" : false,
123+
"buildIndexes" : true,
124+
"hidden" : false,
125+
"priority" : 1,
126+
"tags" : {
127+
128+
},
129+
"slaveDelay" : NumberLong(0),
130+
"votes" : 1
131+
}
132+
],
133+
"settings" : {
134+
"chainingAllowed" : true,
135+
"heartbeatIntervalMillis" : 2000,
136+
"heartbeatTimeoutSecs" : 10,
137+
"electionTimeoutMillis" : 10000,
138+
"catchUpTimeoutMillis" : -1,
139+
"catchUpTakeoverDelayMillis" : 30000,
140+
"getLastErrorModes" : {
141+
142+
},
143+
"getLastErrorDefaults" : {
144+
"w" : 1,
145+
"wtimeout" : 0
146+
},
147+
"replicaSetId" : ObjectId("5eaa1e9ac4d650aa7817623d")
148+
}
149+
},
150+
"commitmentStatus" : true, // Available in MongoDB 4.4
151+
"ok" : 1,
152+
"$clusterTime" : {
153+
"clusterTime" : Timestamp(1588212091, 1),
154+
"signature" : {
155+
"hash" : BinData(0,"veOHa2mOeRTzuR0LKqnzGxWV77k="),
156+
"keyId" : NumberLong("6821298283919441923")
157+
}
158+
},
159+
"operationTime" : Timestamp(1588212091, 1)
160+
}
161+
162+
.. list-table::
163+
:widths: 20 80
164+
165+
* - ``config``
166+
167+
- The replica set configuration. For description of each
168+
configuration settings, see
169+
:doc:`/reference/replica-configuration`.
170+
171+
* - :ref:`commitmentStatus <replSetGetConfig-output-commitmentStatus>`
172+
173+
- .. _replSetGetConfig-output-commitmentStatus:
174+
175+
A boolean that indicates whether the most recent replica set
176+
configuration has been committed; i.e.
177+
178+
- The most recent replica set configuration for the primary has
179+
propagated to a majority of members, and
180+
181+
- The last write operation to the replica set with the previous
182+
configuration has been :data:`majority-commited
183+
<replSetGetStatus.writeMajorityCount>` in the new
184+
configuration.
185+
186+
If ``true``, then the configuration has been committed, and the
187+
replica set can be reconfigured. To reconfigure the replica set,
188+
see :dbcommand:`replSetReconfig` command or the
189+
:binary:`~bin.mongo` shell method :method:`rs.reconfig()`.
190+
191+
If ``false``, then the configuration has not been committed, and
192+
the replica set cannot be reconfigured.
193+
194+
* - ``ok``
195+
196+
- A number that indicates whether the command has succeeded (``1``) or
197+
failed (``0``).
198+
199+
* - | ``operationTime``
200+
| ``$clusterTime``
201+
202+
- Returned with every command for a replica set. See
203+
:ref:`db.adminCommand Response <db-adminCommand-response>` for
204+
details.
40205

41-
For description of the configuration settings, see
42-
:doc:`/reference/replica-configuration`.
43206

44207
.. seealso:: :method:`rs.conf()`, :method:`rs.reconfig()`

source/reference/method/rs.conf.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Definition
2020

2121
The method wraps the :dbcommand:`replSetGetConfig` command.
2222

23+
.. include:: /includes/extracts/4.4-replSetGetConfiguration-commitmentStatus.rst
24+
25+
.. |moreinfo| replace:: The option is only available with the :dbcommand:`replSetGetConfig`
26+
command.
27+
2328
Output Example
2429
--------------
2530

source/release-notes/4.4.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ command.
236236

237237
.. seealso:: :ref:`index-operations`
238238

239+
Safe Replica Set Reconfiguration
240+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
241+
242+
.. container::
243+
244+
.. include:: /includes/extracts/4.4-replSetGetConfiguration-commitmentStatus.rst
245+
246+
.. |moreinfo| replace:: For more information, see the
247+
:ref:`replSetGetConfig <replSetGetConfig-commitmentStatus>` command.
248+
239249
Sharded Clusters
240250
----------------
241251

0 commit comments

Comments
 (0)