0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SERVER-19950: serverStatus({repl:1})

This commit is contained in:
Scott Hernandez 2015-08-20 09:04:51 -04:00
parent d3cce3d105
commit 40fb53421a
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,17 @@
var rt = new ReplSetTest( { name : "server_status_repl" , nodes: 2} );
rt.startSet();
rt.initiate();
rt.awaitSecondaryNodes();
var secondary = rt.getSecondary();
var primary = rt.getPrimary();
var testDB = primary.getDB("test");
assert.commandWorked(testDB.createCollection('a'));
assert.writeOK(testDB.b.insert({}, { writeConcern: { w: 2 }}));
var ss = primary.getDB("test").serverStatus({repl:1});
assert.neq(ss.repl.replicationProgress, null, tojson(ss.repl));
rt.stopSet();

View File

@ -1579,7 +1579,7 @@ void ReplicationCoordinatorImpl::appendSlaveInfoData(BSONObjBuilder* result) {
++itr) {
BSONObjBuilder entry(replicationProgress.subobjStart());
entry.append("rid", itr->rid);
if (isV1ElectionProtocol()) {
if (_isV1ElectionProtocol_inlock()) {
BSONObjBuilder opTime(entry.subobjStart("optime"));
opTime.append("ts", itr->opTime.getTimestamp());
opTime.append("term", itr->opTime.getTerm());