Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-8598

Add initial sync progress information to replSetGetStatus

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.0, 3.6, 4.0.0
    • Component/s: manual, Server
    • Labels:
      None
    • Last comment by Customer:
      true
    • Sprint:
      KANBAN BUCKET

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kay.kim Kay Kim (Inactive)
              Reporter:
              judah.schvimer Judah Schvimer
              Participants:
              Last commenter:
              Kay Kim Kay Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since reply:
                2 years, 46 weeks, 2 days ago
                Date of 1st Reply: