From 40fb53421a35f2401d8412f553091559381e1184 Mon Sep 17 00:00:00 2001 From: Scott Hernandez Date: Thu, 20 Aug 2015 09:04:51 -0400 Subject: [PATCH] SERVER-19950: serverStatus({repl:1}) --- jstests/replsets/server_status_repl.js | 17 +++++++++++++++++ .../db/repl/replication_coordinator_impl.cpp | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 jstests/replsets/server_status_repl.js diff --git a/jstests/replsets/server_status_repl.js b/jstests/replsets/server_status_repl.js new file mode 100644 index 00000000000..787cd2356c0 --- /dev/null +++ b/jstests/replsets/server_status_repl.js @@ -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(); \ No newline at end of file diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index 0bb524738fb..8aada10a473 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -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());