Skip to content

Commit 95e625e

Browse files
author
Kay Kim
committed
DOCS-8598: 3.4 - replSetGetStatus: initialSyncStatus
1 parent 015ee7e commit 95e625e

File tree

3 files changed

+292
-11
lines changed

3 files changed

+292
-11
lines changed

source/reference/command/replSetGetStatus.txt

Lines changed: 273 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,24 @@ Definition
2424

2525
db.adminCommand( { replSetGetStatus: 1 } )
2626

27-
The value specified does not affect the output of the command. Data
28-
provided by this command derives from data included in heartbeats
29-
sent to the server by other members of the replica set.
27+
Starting in MongoDB 3.4, when running on a :doc:`secondary
28+
</core/replica-set-secondary>` member, you can optionally include
29+
``initialSync: 1`` to return :ref:`initial sync
30+
<replica-set-initial-sync>` status information:
31+
32+
.. code-block:: javascript
33+
34+
db.adminCommand( { replSetGetStatus: 1, initialSync: 1 } )
35+
36+
Data provided by this command derives from data included in
37+
heartbeats sent to the server by other members of the replica set.
3038
Because of the frequency of heartbeats, these data can be several
3139
seconds out of date.
3240

41+
The :binary:`~bin.mongo` shell provides the :method:`rs.status()`
42+
helper; however, you cannot specify the ``initialSync: 1`` option
43+
using the helper.
44+
3345
The :binary:`~bin.mongod` instance must have replication enabled and be a
3446
member of a replica set for :dbcommand:`replSetGetStatus` to return
3547
successfully.
@@ -182,10 +194,13 @@ Example
182194

183195
The following example runs the :dbcommand:`replSetGetStatus`
184196
command on the :term:`admin database` of the replica set
185-
primary.
197+
primary. In this example, the optional ``initialSync: 1`` is
198+
included in the command (you can omit if you do not want to
199+
return the initial sync status):
200+
186201
.. code-block:: javascript
187202

188-
db.adminCommand( { replSetGetStatus : 1 } )
203+
db.adminCommand( { replSetGetStatus : 1, initialSync: 1 } )
189204

190205
The command returns the following output for an example replica set secondary:
191206

@@ -220,6 +235,57 @@ Example
220235
},
221236
"lastStableRecoveryTimestamp" : Timestamp(1543869214, 1),
222237
"lastStableCheckpointTimestamp" : Timestamp(1543869214, 1),
238+
"initialSyncStatus" : {
239+
"failedInitialSyncAttempts" : 0,
240+
"maxFailedInitialSyncAttempts" : 10,
241+
"initialSyncStart" : ISODate("2018-12-03T20:29:22.929Z"),
242+
"initialSyncEnd" : ISODate("2018-12-03T20:29:23.546Z"),
243+
"initialSyncElapsedMillis" : 617,
244+
"initialSyncAttempts" : [
245+
{
246+
"durationMillis" : 204,
247+
"status" : "OK",
248+
"syncSource" : "m1.example.net:27017"
249+
}
250+
],
251+
"fetchedMissingDocs" : 0,
252+
"appliedOps" : 0,
253+
"initialSyncOplogStart" : Timestamp(1543868962, 1),
254+
"initialSyncOplogEnd" : Timestamp(1543868962, 1),
255+
"databases" : {
256+
"databasesCloned" : 1,
257+
"admin" : {
258+
"collections" : 1,
259+
"clonedCollections" : 1,
260+
"start" : ISODate("2018-12-03T20:29:23.342Z"),
261+
"end" : ISODate("2018-12-03T20:29:23.528Z"),
262+
"elapsedMillis" : 186,
263+
"admin.system.version" : {
264+
"documentsToCopy" : 1,
265+
"documentsCopied" : 1,
266+
"indexes" : 1,
267+
"fetchedBatches" : 1,
268+
"start" : ISODate("2018-12-03T20:29:23.344Z"),
269+
"end" : ISODate("2018-12-03T20:29:23.528Z"),
270+
"elapsedMillis" : 184
271+
}
272+
},
273+
...
274+
"foo" : {
275+
"collections" : 1,
276+
"clonedCollections" : 0,
277+
"start" : ISODate("2018-12-04T18:56:36.054Z"),
278+
"foo.hugeindex" : {
279+
"documentsToCopy" : 25000,
280+
"documentsCopied" : 25000,
281+
"indexes" : 2,
282+
"fetchedBatches" : 21,
283+
"start" : ISODate("2018-12-04T18:56:36.056Z")
284+
}
285+
},
286+
287+
}
288+
},
223289
"members" : [
224290
{
225291
"_id" : 0,
@@ -439,6 +505,208 @@ following fields:
439505

440506
A ``null`` value indicates that no stable checkpoint exists.
441507

508+
.. data:: replSetGetStatus.initialSyncStatus
509+
510+
.. versionadded:: 3.4
511+
512+
*Available only if the command is run with the initialSync: 1
513+
option on a secondary*
514+
515+
A document provides information on the progress and status of
516+
:ref:`initial sync <replica-set-initial-sync>` on this secondary.
517+
518+
.. note::
519+
520+
Some fields that relate to the progress of an on-going initial
521+
sync only appear while the initial sync is in progress and do not
522+
appear once the initial sync completes.
523+
524+
.. data:: replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts
525+
526+
.. versionadded:: 3.4
527+
528+
*Available only if the command is run with the initialSync: 1
529+
option on a secondary*
530+
531+
The number of times the :ref:`initial sync
532+
<replica-set-initial-sync>` failed and had to restart on this
533+
secondary.
534+
535+
.. data:: replSetGetStatus.initialSyncStatus.maxFailedInitialSyncAttempts
536+
537+
.. versionadded:: 3.4
538+
539+
*Available only if the command is run with the initialSync: 1
540+
option on a secondary*
541+
542+
The maximum number of times the :ref:`initial sync
543+
<replica-set-initial-sync>` can restart on this secondary
544+
before the member shuts down.
545+
546+
.. data:: replSetGetStatus.initialSyncStatus.initialSyncStart
547+
548+
.. versionadded:: 3.4
549+
550+
*Available only if the command is run with the initialSync: 1
551+
option on a secondary*
552+
553+
The start timestamp of the :ref:`initial sync
554+
<replica-set-initial-sync>` for this secondary.
555+
556+
.. data:: replSetGetStatus.initialSyncStatus.initialSyncEnd
557+
558+
.. versionadded:: 3.4
559+
560+
*Available only if the command is run with the initialSync: 1
561+
option on a secondary*
562+
563+
The end timestamp of the :ref:`initial sync
564+
<replica-set-initial-sync>` for this secondary.
565+
566+
.. data:: replSetGetStatus.initialSyncStatus.initialSyncElapsedMillis
567+
568+
.. versionadded:: 3.4
569+
570+
*Available only if the command is run with the initialSync: 1
571+
option on a secondary*
572+
573+
The number of milliseconds between
574+
:data:`~replSetGetStatus.initialSyncStatus.initialSyncStart`
575+
and :data:`~replSetGetStatus.initialSyncStatus.initialSyncEnd`.
576+
577+
.. data:: replSetGetStatus.initialSyncStatus.initialSyncAttempts
578+
579+
.. versionadded:: 3.4
580+
581+
*Available only if the command is run with the initialSync: 1
582+
option on a secondary*
583+
584+
Array of documents where each document corresponds to a single
585+
:ref:`initial sync <replica-set-initial-sync>` attempt. See also
586+
:data:`~replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts`.
587+
588+
Each document contains the following information for the initial sync attempt:
589+
590+
.. code-block:: javascript
591+
592+
{
593+
"durationMillis" : <duration in milliseconds>,
594+
"status" : <exit status>,
595+
"syncSource" : <source node from which this secondary performs initial sync>
596+
}
597+
598+
.. data:: replSetGetStatus.initialSyncStatus.fetchedMissingDocs
599+
600+
.. versionadded:: 3.4
601+
602+
*Available only if the command is run with the initialSync: 1
603+
option on a secondary*
604+
605+
The number of missing (i.e. uncloned) documents that were fetched
606+
from the sync source in order to apply to those documents the
607+
updates that occurred after the :ref:`initial sync
608+
<replica-set-initial-sync>` started.
609+
610+
As part of the initial sync process, the secondary uses the oplog
611+
to update its data set to reflect the current state of the
612+
replica set.
613+
614+
.. data:: replSetGetStatus.initialSyncStatus.appliedOps
615+
616+
.. versionadded:: 3.4
617+
618+
*Available only if the command is run with the initialSync: 1
619+
option on a secondary*
620+
621+
The number of ops that occurred after the :ref:`initial sync
622+
<replica-set-initial-sync>` started and were applied after cloning
623+
the databases.
624+
625+
As part of the initial sync process, the secondary uses the oplog
626+
to update its data set to reflect the current state of the
627+
replica set.
628+
629+
.. data:: replSetGetStatus.initialSyncStatus.initialSyncOplogStart
630+
631+
.. versionadded:: 3.4
632+
633+
*Available only if the command is run with the initialSync: 1
634+
option on a secondary*
635+
636+
The start timestamp of the oplog application stage of the
637+
:ref:`initial sync <replica-set-initial-sync>` where the
638+
secondary applies changes that occurred after the initial sync
639+
start.
640+
641+
As part of the initial sync process, the secondary uses the oplog
642+
to update its data set to reflect the current state of the
643+
replica set.
644+
645+
.. data:: replSetGetStatus.initialSyncStatus.initialSyncOplogEnd
646+
647+
.. versionadded:: 3.4
648+
649+
*Available only if the command is run with the initialSync: 1
650+
option on a secondary*
651+
652+
The end timestamp of the oplog application stage of the
653+
:ref:`initial sync <replica-set-initial-sync>` where the
654+
secondary applies changes that occurred after the initial sync
655+
start.
656+
657+
As part of the initial sync process, the secondary uses the oplog
658+
to update its data set to reflect the current state of the
659+
replica set.
660+
661+
.. data:: replSetGetStatus.initialSyncStatus.databases
662+
663+
.. versionadded:: 3.4
664+
665+
*Available only if the command is run with the initialSync: 1
666+
option on a secondary*
667+
668+
Detail on the databases cloned during :ref:`initial sync
669+
<replica-set-initial-sync>`.
670+
671+
.. data:: replSetGetStatus.initialSyncStatus.databases.databasesCloned
672+
673+
.. versionadded:: 3.4
674+
675+
*Available only if the command is run with the initialSync: 1
676+
option on a secondary*
677+
678+
Number of databases cloned during :ref:`initial sync
679+
<replica-set-initial-sync>`.
680+
681+
.. data:: replSetGetStatus.initialSyncStatus.databases.<dbname>
682+
683+
.. versionadded:: 3.4
684+
685+
*Available only if the command is run with the initialSync: 1
686+
option on a secondary*
687+
688+
For each database, a document that returns information regarding
689+
the progress of the cloning of that database.
690+
691+
.. code-block:: javascript
692+
693+
{
694+
"collections" : <number of collections to clone in the database>,
695+
"clonedCollections" : <number of collections cloned to date>,
696+
"start" : <start date and time for the database clone>,
697+
"end" : <end date and time for the database clone>,
698+
"elapsedMillis" : <duration of the database clone>,
699+
"<db>.<collection>" : {
700+
"documentsToCopy" : <number of documents to copy>,
701+
"documentsCopied" : <number of documents copied to date>,
702+
"indexes" : <number of indexes>,
703+
"fetchedBatches" : <number of batches of documents fetched to date>,
704+
"start" : <start date and time for the collection clone>,
705+
"end" : <end date and time for the collection clone>,
706+
"elapsedMillis" : <duration of the collection clone>,
707+
}
708+
}
709+
442710
.. data:: replSetGetStatus.members
443711

444712
The ``members`` field holds an array that contains a document for

source/reference/method/rs.status.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,21 @@ rs.status()
1212

1313
.. method:: rs.status()
1414

15-
:returns: A :term:`document` with status information.
15+
:returns: A :ref:`document <rs-status-output>` with status
16+
information.
1617

1718
This output reflects the current status of the replica set, using
1819
data derived from the heartbeat packets sent by the other members
1920
of the replica set.
2021

2122
This method provides a wrapper around the
22-
:dbcommand:`replSetGetStatus` command. See the
23-
documentation of the command for a complete description
24-
of the :ref:`output <rs-status-output>`.
23+
:dbcommand:`replSetGetStatus` command.
24+
25+
Starting in MongoDB 3.4, the :dbcommand:`replSetGetStatus` command
26+
can accept the optional ``initialSync: 1`` to report on initial sync
27+
status and progress if the command is run on the secondary. To
28+
report on initial sync for the secondary, you must run the command
29+
instead of the helper.
30+
31+
See the documentation of the :dbcommand:`replSetGetStatus` command
32+
for a complete description of the :ref:`output <rs-status-output>`.

source/release-notes/3.4.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,13 @@ Improved Initial Sync
591591

592592
For details, see :ref:`3.4-compatibility-initial-sync`.
593593

594-
- Modified :ref:`rs.status() output <rs-status-output>` to report on
595-
initial sync status and progress.
594+
- Modified :dbcommand:`replSetGetStatus` command to accept the optional
595+
``initialSync: 1`` in the command to report on initial sync status
596+
and progress if run on the secondary:
597+
598+
.. code-block:: javascript
599+
600+
db.adminCommand( { replSetGetStatus: 1, initialSync: 1 } )
596601

597602
.. _3.4-decimal:
598603

0 commit comments

Comments
 (0)