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

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

View File

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