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:
parent
e987d4c8ad
commit
5f70df96b5
11
shell/db.js
11
shell/db.js
@ -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;
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user