summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-08-10 10:22:13 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-16 12:12:26 +0000
commit268081db9538c5db216c83a1b63f83540be0075c (patch)
tree8d5eebfdc665f6d6de9f074d308bf02786c7e362 /src
parent25e3aeda438f7144b6771618ce1c9dd4dbee3f7e (diff)
downloadmongo-268081db9538c5db216c83a1b63f83540be0075c.tar.gz
SERVER-49991 Alias db. and rs.printSlaveReplicationInfo() to printSecondaryReplicationInfo()
(cherry picked from commit 996dcdc3d96346d71f012388eccc79c691619340)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/shell/db.js20
-rw-r--r--src/mongo/shell/utils.js9
2 files changed, 20 insertions, 9 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index 6ec674be46a..c5dd29922d5 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -635,7 +635,7 @@ var DB;
print("\tdb.printCollectionStats()");
print("\tdb.printReplicationInfo()");
print("\tdb.printShardingStatus()");
- print("\tdb.printSlaveReplicationInfo()");
+ print("\tdb.printSecondaryReplicationInfo(()");
print("\tdb.dropUser(username)");
print("\tdb.repairDatabase()");
print("\tdb.resetError()");
@@ -1183,8 +1183,8 @@ var DB;
print("cannot provide replication status from an arbiter.");
return;
} else if (!isMaster.ismaster) {
- print("this is a slave, printing slave replication info.");
- this.printSlaveReplicationInfo();
+ print("this is a secondary, printing secondary replication info.");
+ this.printSecondaryReplicationInfo();
return;
}
print(tojson(result));
@@ -1199,6 +1199,12 @@ var DB;
};
DB.prototype.printSlaveReplicationInfo = function() {
+ print(
+ "WARNING: printSlaveReplicationInfo is deprecated and may be removed in the next major release. Please use printSecondaryReplicationInfo instead.");
+ this.printSecondaryReplicationInfo();
+ };
+
+ DB.prototype.printSecondaryReplicationInfo = function() {
var startOptimeDate = null;
var primary = null;
@@ -1216,7 +1222,7 @@ var DB;
print("\t" + Math.round(ago) + " secs (" + hrs + " hrs) behind the " + suffix);
}
- function getMaster(members) {
+ function getPrimary(members) {
for (i in members) {
var row = members[i];
if (row.state === 1) {
@@ -1228,7 +1234,7 @@ var DB;
}
function g(x) {
- assert(x, "how could this be null (printSlaveReplicationInfo gx)");
+ assert(x, "how could this be null (printSecondaryReplicationInfo gx)");
print("source: " + x.host);
if (x.syncedTo) {
var st = new Date(DB.tsToSeconds(x.syncedTo) * 1000);
@@ -1239,7 +1245,7 @@ var DB;
}
function r(x) {
- assert(x, "how could this be null (printSlaveReplicationInfo rx)");
+ assert(x, "how could this be null (printSecondaryReplicationInfo rx)");
if (x.state == 1 || x.state == 7) { // ignore primaries (1) and arbiters (7)
return;
}
@@ -1256,7 +1262,7 @@ var DB;
if (L.system.replset.count() != 0) {
var status = this.adminCommand({'replSetGetStatus': 1});
- primary = getMaster(status.members);
+ primary = getPrimary(status.members);
if (primary) {
startOptimeDate = primary.optimeDate;
}
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 13c8f2f8a4f..9418a5aec77 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -1392,7 +1392,7 @@ rs.help = function() {
print();
print("\trs.printReplicationInfo() check oplog size and time range");
print(
- "\trs.printSlaveReplicationInfo() check replica set members and replication lag");
+ "\trs.printSecondaryReplicationInfo() check replica set members and replication lag");
print("\tdb.isMaster() check who is primary");
print("\tdb.hello() check who is primary");
print();
@@ -1422,7 +1422,12 @@ rs.initiate = function(c) {
return db._adminCommand({replSetInitiate: c});
};
rs.printSlaveReplicationInfo = function() {
- return db.printSlaveReplicationInfo();
+ print(
+ "WARNING: printSlaveReplicationInfo is deprecated and may be removed in the next major release. Please use printSecondaryReplicationInfo instead.");
+ return db.printSecondaryReplicationInfo();
+};
+rs.printSecondaryReplicationInfo = function() {
+ return db.printSecondaryReplicationInfo();
};
rs.printReplicationInfo = function() {
return db.printReplicationInfo();