[DOCS-1485] Replication Info - Some confusing categorization Created: 06/May/13  Updated: 30/Oct/23  Resolved: 09/May/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Adam Comerford Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 10 years, 40 weeks, 6 days ago

 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)"
}



 Comments   
Comment by auto [ 09/May/13 ]

Author:

{u'date': u'2013-05-09T16:42:12Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1485 backport changes to db.replicationInfo
Branch: v2.2
https://github.com/mongodb/docs/commit/2d95f3950ed4d371fcd4a696a3d7b4cd5d56e3da

Comment by auto [ 09/May/13 ]

Author:

{u'date': u'2013-05-09T16:39:27Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1485 clarification on primary/secondary fields in db.getReplicationInfo
Branch: master
https://github.com/mongodb/docs/commit/fb20dd079385ae9fe918dabbfb5d0200dab2c773

Comment by Adam Comerford [ 06/May/13 ]

Original discussion:

https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/WvcE0sC-z0M

Generated at Thu Feb 08 07:41:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.