[SERVER-47863] Initial Sync Progress Metrics Created: 30/Apr/20  Updated: 29/Oct/23  Resolved: 16/Nov/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.9.0, 4.4.3, 4.2.12

Type: Improvement Priority: Major - P3
Reporter: Evin Roesle Assignee: Jason Chan
Resolution: Fixed Votes: 3
Labels: former-quick-wins
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-53017 replSetGetStatus remainingInitialSync... Closed
related to SERVER-53476 Don't include initial sync metrics in... Closed
related to SERVER-53382 Add additional initial sync metrics t... Backlog
related to SERVER-50624 Submit Log Ingestion Rule Request For... Closed
is related to SERVER-54266 Update tenant migration recipient cur... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4, v4.2, v4.0, v3.6
Sprint: Repl 2020-10-19, Repl 2020-11-16, Repl 2020-11-30
Participants:

 Description   

Improve the Initial Sync Progress Metrics. 

Proposed new structure in ReplSetGetStatus:

New metrics in bold

"initialSyncStatus": {
     "failedInitialSyncAttempts": 0,
     "maxFailedInitialSyncAttempts": 10,
       *approxTotalDataSize*
       *approxTotalBytesCopied*
     "initialSyncStart": ISODate("2019-12-04T05:12:35.719Z"),
       *totalInitialSyncElapsedMillis*
       *remainingInitialSyncEstimatedMillis*
     "initialSyncAttempts": [],
     "fetchedMissingDocs": 0,
     "appliedOps": 0,
     "initialSyncOplogStart": Timestamp(1575436355, 1),
     "databases": {
          *databasesToClone*
       "databasesCloned": 2,
       "admin": {
         "collections": 4,
         "clonedCollections": 4,
         "start": ISODate("2019-12-04T05:12:35.947Z"),
         "end": ISODate("2019-12-04T05:12:36.486Z"),
         "elapsedMillis": 539,
         "admin.system.roles":{
            "documentsToCopy": 12,
            "documentsCopied": 12,
             *bytesToCopy*
             *approxBytesCopied*
            "indexes": 2,
            "fetchedBatches": 1,
            "start": ISODate("2019-12-04T05:12:35.950Z"),
            "end": ISODate("2019-12-04T05:12:36.101Z"),
            "elapsedMillis": 151,
            "receivedBatches": 1 
          },
       },
    }
 },

 

New Metrics Details

  • totalInitialSyncElapsedMillis
  • = Current Time - Start Time
  • remainingInitialSyncEstimatedMillis
  • = (totalInitialSyncElapsedMillis / approxTotalBytesCopied) * (approxTotalDataSize - approxTotalBytesCopied)
  • If (approxBytesCopied == 0), this field will not be shown
  • <collection>.bytesToCopy
  • = collStats.size
  • <collection>.approxBytesCopied
  • = collStats.avgObjSize * documentsCopied
  • databasesToClone
  • = length of listDatabases response
  • approxTotalDataSize
  • = Sum (dbStats.dataSize for all databases)
  • approxTotalBytesCopied
  • = Sum (collection.approxBytesCopied for all collections)

Proposed changes to rs.status()

  • Inherit changes to replSetGetStatus
  • No changes to rs.status() specifically

Proposed changes to db.getReplicationInfo()

  • No change, the current metrics are unrelated to initial sync

Proposed changes to rs.printReplicationInfo()

  • No change, the current metrics are unrelated to initial sync

Proposed changes to rs.printSlaveReplicationInfo()

Current output:

When doing Initial Sync:

MongoDB Enterprise replset:PRIMARY> rs.printSlaveReplicationInfo()
source: localhost:27018
          syncedTo: Mon Apr 20 2020 12:38:47 GMT+0100 (WEST)
          0 secs (0 hrs) behind the primary
source: localhost:27019
          syncedTo: Thu Jan 01 1970 01:00:00 GMT+0100 (CET)
          1587382727 secs (440939.65 hrs) behind the primary
 

Suggested output:

MongoDB Enterprise replset:PRIMARY> rs.printSlaveReplicationInfo()
source: localhost:27018
          syncedTo: Mon Apr 20 2020 12:38:47 GMT+0100 (WEST)
          0 secs (0 hrs) behind the primary
source: localhost:27019
           *InitialSyncSyncSource: <host:port>*
           *InitialSyncRemainingEstimatedDuration: “remainingInitialSyncEstimatedMillis” in X hours Y minutes*

 



 Comments   
Comment by Githook User [ 07/Dec/20 ]

Author:

{'name': 'Jason Chan', 'email': 'jason.chan@10gen.com', 'username': 'jasonjhchan'}

Message: SERVER-47863 Add fields to initial sync progress metrics
Branch: v4.2
https://github.com/mongodb/mongo/commit/07430d1cb41b102670783afeb21361d61b564783

Comment by Githook User [ 19/Nov/20 ]

Author:

{'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com', 'username': 'jasonjhchan'}

Message: SERVER-47863 Add fields to initial sync progress metrics

(cherry picked from commit 058228ec1106b71d5fe3a3a07e1c0a050a1a1485)
Branch: v4.4
https://github.com/mongodb/mongo/commit/0ff0bfe23d9db9ad283066a2169cb7f3aa9321ee

Comment by Githook User [ 16/Nov/20 ]

Author:

{'name': 'Jason Chan', 'email': 'jason.chan@mongodb.com', 'username': 'jasonjhchan'}

Message: SERVER-47863 Add fields to initial sync progress metrics
Branch: master
https://github.com/mongodb/mongo/commit/058228ec1106b71d5fe3a3a07e1c0a050a1a1485

Generated at Thu Feb 08 05:15:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.