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

Replication Info - Some confusing categorization

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • None

    Description

      This lists a couple of fields that are present on primaries only:

      http://docs.mongodb.org/manual/reference/replication-info/#primary-nodes

      In fact, they are present only when the oplog is empty, see:

      https://github.com/mongodb/mongo/blob/v2.4/src/mongo/shell/db.js#L815

      To confirm:

      // delete oplog, crete new and empty
      testReplSet:PRIMARY> use local
      switched to db local
      testReplSet:PRIMARY> db.oplog.rs.drop()
      true
      testReplSet:PRIMARY> db.createCollection("oplog.rs", {capped:1, size: 2*1024*1024, autoIndexId:false})
      { "ok" : 1 }
      // run the command to get the fields
      testReplSet:PRIMARY> db.getReplicationInfo()
      {
              "logSizeMB" : 2,
              "usedMB" : 0,
              "errmsg" : "objects not found in local.oplog.$main -- is this a new and empty db instance?",
              "oplogMainRowCount" : 0
      }
      // insert anything, to populate the oplog
      testReplSet:PRIMARY> use test
      switched to db test
      testReplSet:PRIMARY> db.foo.insert({"a" : 1})
      // and now the extra fields are gone
      testReplSet:PRIMARY> db.getReplicationInfo()
      {
              "logSizeMB" : 2,
              "usedMB" : 0.01,
              "timeDiff" : 0,
              "timeDiffHours" : 0,
              "tFirst" : "Mon May 06 2013 14:17:09 GMT+0100 (IST)",
              "tLast" : "Mon May 06 2013 14:17:09 GMT+0100 (IST)",
              "now" : "Mon May 06 2013 14:17:11 GMT+0100 (IST)"
      }

      Attachments

        Activity

          People

            sam.kleinman Sam Kleinman (Inactive)
            adamc Adam Comerford
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 years, 40 weeks, 6 days ago