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:
parent
d3cce3d105
commit
40fb53421a
17
jstests/replsets/server_status_repl.js
Normal file
17
jstests/replsets/server_status_repl.js
Normal 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();
|
@ -1579,7 +1579,7 @@ void ReplicationCoordinatorImpl::appendSlaveInfoData(BSONObjBuilder* result) {
|
|||||||
++itr) {
|
++itr) {
|
||||||
BSONObjBuilder entry(replicationProgress.subobjStart());
|
BSONObjBuilder entry(replicationProgress.subobjStart());
|
||||||
entry.append("rid", itr->rid);
|
entry.append("rid", itr->rid);
|
||||||
if (isV1ElectionProtocol()) {
|
if (_isV1ElectionProtocol_inlock()) {
|
||||||
BSONObjBuilder opTime(entry.subobjStart("optime"));
|
BSONObjBuilder opTime(entry.subobjStart("optime"));
|
||||||
opTime.append("ts", itr->opTime.getTimestamp());
|
opTime.append("ts", itr->opTime.getTimestamp());
|
||||||
opTime.append("term", itr->opTime.getTerm());
|
opTime.append("term", itr->opTime.getTerm());
|
||||||
|
Loading…
Reference in New Issue
Block a user