-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Labels:None
With the new initial sync code, replSetGetStatus will now report information about the progress of initial sync. The replSetGetStatus command now accepts a second option: initialSync. For example:
db.runCommand({replSetGetStatus: 1, initialSync: 1})
The response will look like:
{ "set": "initial_sync_replSetGetStatus", "date": ISODate("2016-08-15T20:27:25.081Z"), "myState": 5, "term": NumberLong(1), "syncingTo": "localhost:20010", "heartbeatIntervalMillis": NumberLong(2000), "optimes": { "lastCommittedOpTime": { "ts": Timestamp(1471292844, 2), "t": NumberLong(1) }, "appliedOpTime": { "ts": Timestamp(1471292844, 2), "t": NumberLong(1) }, "durableOpTime": { "ts": Timestamp(1471292844, 2), "t": NumberLong(1) } }, "initialSyncStatus": { "failedInitialSyncAttempts": 0, "maxFailedInitialSyncAttempts": 10, "initialSyncStart": ISODate("2016-08-15T20:27:23.028Z"), "initialSyncEnd": ISODate("2016-08-15T20:27:24.302Z"), "initialSyncElapsedMillis": 1274, "initialSyncAttempts": [ { "durationMillis": 1147, "status": "OK", "syncSource": "localhost:20010" } ], "fetchedMissingDocs": 0, "appliedOps": 2, "databases": { "databasesCloned": 1, "test": { "collections": 1, "clonedCollections": 1, "start": ISODate("2016-08-15T20:27:24.171Z"), "end": ISODate("2016-08-15T20:27:24.291Z"), "elapsedMillis": 120, "test.foo": { "documents": 4, "indexes": 1, "fetchedBatches": 1, "start": ISODate("2016-08-15T20:27:24.173Z"), "end": ISODate("2016-08-15T20:27:24.291Z"), "elapsedMillis": 118 } } } }, "members": [ { "_id": 0, "name": "localhost:20010", "health": 1, "state": 1, "stateStr": "PRIMARY", "uptime": 2, "optime": { "ts": Timestamp(1471292842, 5), "t": NumberLong(1) }, "optimeDurable": { "ts": Timestamp(1471292842, 5), "t": NumberLong(1) }, "optimeDate": ISODate("2016-08-15T20:27:22Z"), "optimeDurableDate": ISODate("2016-08-15T20:27:22Z"), "lastHeartbeat": ISODate("2016-08-15T20:27:23.028Z"), "lastHeartbeatRecv": ISODate("2016-08-15T20:27:24.991Z"), "pingMs": NumberLong(1), "electionTime": Timestamp(1471292841, 2), "electionDate": ISODate("2016-08-15T20:27:21Z"), "configVersion": 2 }, { "_id": 1, "name": "localhost:20011", "health": 1, "state": 5, "stateStr": "STARTUP2", "uptime": 3, "optime": { "ts": Timestamp(1471292844, 2), "t": NumberLong(1) }, "optimeDate": ISODate("2016-08-15T20:27:24Z"), "syncingTo": "localhost:20010", "infoMessage": "syncing from: localhost:20010", "configVersion": 2, "self": true } ], "ok": 1 }
The fields change depending on the progress made so far and after initial sync finishes the progress data is logged, but will no longer appear in replSetGetStatus.
failedInitialSyncAttempts = the number of times initial sync failed and had to restart
maxFailedInitialSyncAttempts = the max number of times initial sync will restart before mongod shuts down
initialSyncStart = start time
InitialSyncEnd = end time
initialSyncElapsedMillis = milliseconds between start and end above
initialSyncAttempts = array of objects where durationMillis = duration for the attempt, status = exit status of the attempt, including the error message if it failed. syncSource = the node that this node is initial syncing from.
fetchedMissingDocs = the number of documents that we needed to fetch from the sync source when applying ops that occurred after initial sync began.
appliedOps = number of ops that occurred after initialsync began that needed to be applied at the end of initial sync
databases = an object containing information about the database cloning.
databases.databasesCloned = number of databases done being cloned
databases.<database name> = information about the cloning of that database.
databases.<database name>.collections = number of collections in the database
databases.<database name>.clonedCollections = number of collections done being cloned from the database
databases.<database name>.start = start time for the database clone
databases.<database name>.end = end time for the database clone
databases.<database name>.elapsedMillis = time between start and end for the database clone
databases.<database name>.<collection namespace> = information about the collection cloning process.
databases.<database name>.<collection namespace>.documents = documents cloned so far
databases.<database name>.<collection namespace>.indexes = indexes cloned so far
databases.<database name>.<collection namespace>.fetchedBatches = number of batches of documents fetched so far
databases.<database name>.<collection namespace>.start = start time for the collection clone
databases.<database name>.<collection namespace>.end = end time for the collection clone
databases.<database name>.<collection namespace>.elapsedMillis = time between start and end of collection clone.
- documents
-
SERVER-25125 Add initial sync progress information to replSetGetStatus
- Closed
- related to
-
DOCS-9753 3.4 Release notes inaccurately state: rs.status() output to report on initial sync status and progress
- Closed
-
DOCS-12844 Investigate changes in SERVER-7019: rs.status needs to show initial sync happening
- Closed