0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

default to using rsGetStatus for slaveReplInfo SERVER-3376

This commit is contained in:
Kristina 2011-07-07 15:48:06 -04:00
parent e987d4c8ad
commit 5f70df96b5
2 changed files with 11 additions and 9 deletions

View File

@ -712,7 +712,7 @@ DB.prototype.printSlaveReplicationInfo = function() {
print("\t syncedTo: " + st.toString() );
var ago = (now-st)/1000;
var hrs = Math.round(ago/36)/100;
print("\t\t = " + Math.round(ago) + "secs ago (" + hrs + "hrs)");
print("\t\t = " + Math.round(ago) + " secs ago (" + hrs + "hrs)");
};
function g(x) {
@ -743,13 +743,14 @@ DB.prototype.printSlaveReplicationInfo = function() {
};
var L = this.getSiblingDB("local");
if( L.sources.count() != 0 ) {
L.sources.find().forEach(g);
}
else if (L.system.replset.count() != 0) {
if (L.system.replset.count() != 0) {
var status = this.adminCommand({'replSetGetStatus' : 1});
status.members.forEach(r);
}
else if( L.sources.count() != 0 ) {
L.sources.find().forEach(g);
}
else {
print("local.sources is empty; is this db a --slave?");
return;

View File

@ -2440,13 +2440,14 @@ const StringData _jscode_raw_db =
"};\n"
"\n"
"var L = this.getSiblingDB(\"local\");\n"
"if( L.sources.count() != 0 ) {\n"
"L.sources.find().forEach(g);\n"
"}\n"
"else if (L.system.replset.count() != 0) {\n"
"\n"
"if (L.system.replset.count() != 0) {\n"
"var status = this.adminCommand({'replSetGetStatus' : 1});\n"
"status.members.forEach(r);\n"
"}\n"
"else if( L.sources.count() != 0 ) {\n"
"L.sources.find().forEach(g);\n"
"}\n"
"else {\n"
"print(\"local.sources is empty; is this db a --slave?\");\n"
"return;\n"