summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Mir <ali.mir@mongodb.com>2020-09-16 19:05:21 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-28 18:43:50 +0000
commit6fb29e6445de3aec270c5f719264f80167c304ed (patch)
tree393e4840450c4c596511f5dc418778a9736206b4
parent93cff71bfc5b28d0724e9c19f52041f249fb854c (diff)
downloadmongo-6fb29e6445de3aec270c5f719264f80167c304ed.tar.gz
SERVER-50651 Replace occurrences of isMaster command with hello in sharding jstests
-rw-r--r--jstests/sharding/advance_logical_time_with_valid_signature.js6
-rw-r--r--jstests/sharding/arbiters_do_not_use_cluster_time.js2
-rw-r--r--jstests/sharding/authCommands.js4
-rw-r--r--jstests/sharding/auth_slaveok_routing.js4
-rw-r--r--jstests/sharding/change_streams/resume_change_stream.js2
-rw-r--r--jstests/sharding/features2.js38
-rw-r--r--jstests/sharding/key_rotation.js4
-rw-r--r--jstests/sharding/logical_time_api.js4
-rw-r--r--jstests/sharding/mongod_returns_no_cluster_time_without_keys.js4
-rw-r--r--jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js4
-rw-r--r--jstests/sharding/mongos_no_replica_set_refresh.js2
-rw-r--r--jstests/sharding/mongos_quiesce_mode.js22
-rw-r--r--jstests/sharding/non_transaction_snapshot_errors.js2
-rw-r--r--jstests/sharding/query/aggregation_currentop.js2
-rw-r--r--jstests/sharding/query/explain_read_pref.js6
-rw-r--r--jstests/sharding/read_pref_cmd.js4
-rw-r--r--jstests/sharding/server_status.js4
-rw-r--r--jstests/sharding/shard_aware_init.js16
-rw-r--r--jstests/sharding/shard_aware_on_add_shard.js10
19 files changed, 70 insertions, 70 deletions
diff --git a/jstests/sharding/advance_logical_time_with_valid_signature.js b/jstests/sharding/advance_logical_time_with_valid_signature.js
index fccd047f6fd..2336513f67f 100644
--- a/jstests/sharding/advance_logical_time_with_valid_signature.js
+++ b/jstests/sharding/advance_logical_time_with_valid_signature.js
@@ -26,12 +26,12 @@ let disconnectedDB = st.s1.getDB("test");
// Send an insert to the connected mongos to advance its cluster time.
let res = assert.commandWorked(connectedDB.runCommand({insert: "foo", documents: [{x: 1}]}));
-// Get logicalTime metadata from the connected mongos's response and send it in an isMaster
-// command to the disconnected mongos. isMaster does not require mongos to contact any other
+// Get logicalTime metadata from the connected mongos's response and send it in a hello
+// command to the disconnected mongos. hello does not require mongos to contact any other
// servers, so the command should succeed.
let lt = res.$clusterTime;
res =
- assert.commandWorked(disconnectedDB.runCommand({isMaster: 1, $clusterTime: lt}),
+ assert.commandWorked(disconnectedDB.runCommand({hello: 1, $clusterTime: lt}),
"expected the disconnected mongos to accept cluster time: " + tojson(lt));
// Verify cluster time response from the disconnected mongos matches what was passed.
diff --git a/jstests/sharding/arbiters_do_not_use_cluster_time.js b/jstests/sharding/arbiters_do_not_use_cluster_time.js
index 03bf0f32f5a..92ca09b29eb 100644
--- a/jstests/sharding/arbiters_do_not_use_cluster_time.js
+++ b/jstests/sharding/arbiters_do_not_use_cluster_time.js
@@ -14,7 +14,7 @@ let secondaries = st.rs0.getSecondaries();
let foundArbiter = false;
for (let i = 0; i < secondaries.length; i++) {
let conn = secondaries[i].getDB("admin");
- const res = conn.runCommand({isMaster: 1});
+ const res = conn.runCommand({hello: 1});
if (res["arbiterOnly"]) {
assert(!foundArbiter);
foundArbiter = true;
diff --git a/jstests/sharding/authCommands.js b/jstests/sharding/authCommands.js
index 7c799d6c3e5..3c1e6ab9b27 100644
--- a/jstests/sharding/authCommands.js
+++ b/jstests/sharding/authCommands.js
@@ -217,6 +217,7 @@ var checkAdminOps = function(hasAuth) {
checkCommandSucceeded(adminDB, {whatsmyuri: 1});
checkCommandSucceeded(adminDB, {isdbgrid: 1});
checkCommandSucceeded(adminDB, {ismaster: 1});
+ checkCommandSucceeded(adminDB, {hello: 1});
checkCommandSucceeded(adminDB, {split: 'test.foo', find: {i: 1, j: 1}});
var chunk = configDB.chunks.findOne({ns: 'test.foo', shard: st.rs0.name});
checkCommandSucceeded(
@@ -226,10 +227,11 @@ var checkAdminOps = function(hasAuth) {
checkCommandFailed(adminDB, {getCmdLineOpts: 1});
checkCommandFailed(adminDB, {serverStatus: 1});
checkCommandFailed(adminDB, {listShards: 1});
- // whatsmyuri, isdbgrid, and ismaster don't require any auth
+ // whatsmyuri, isdbgrid, ismaster, and hello don't require any auth
checkCommandSucceeded(adminDB, {whatsmyuri: 1});
checkCommandSucceeded(adminDB, {isdbgrid: 1});
checkCommandSucceeded(adminDB, {ismaster: 1});
+ checkCommandSucceeded(adminDB, {hello: 1});
checkCommandFailed(adminDB, {split: 'test.foo', find: {i: 1, j: 1}});
var chunkKey = {i: {$minKey: 1}, j: {$minKey: 1}};
checkCommandFailed(
diff --git a/jstests/sharding/auth_slaveok_routing.js b/jstests/sharding/auth_slaveok_routing.js
index 1e573fc7c9e..9df5103e824 100644
--- a/jstests/sharding/auth_slaveok_routing.js
+++ b/jstests/sharding/auth_slaveok_routing.js
@@ -29,9 +29,9 @@ function doesRouteToSec(coll, query) {
assert.eq("SINGLE_SHARD", explain.queryPlanner.winningPlan.stage);
var serverInfo = explain.queryPlanner.winningPlan.shards[0].serverInfo;
var conn = new Mongo(serverInfo.host + ":" + serverInfo.port.toString());
- var cmdRes = conn.getDB('admin').runCommand({isMaster: 1});
+ var cmdRes = conn.getDB('admin').runCommand({hello: 1});
- jsTest.log('isMaster: ' + tojson(cmdRes));
+ jsTest.log('hello: ' + tojson(cmdRes));
return cmdRes.secondary;
}
diff --git a/jstests/sharding/change_streams/resume_change_stream.js b/jstests/sharding/change_streams/resume_change_stream.js
index 2030a71af14..f96dfc113af 100644
--- a/jstests/sharding/change_streams/resume_change_stream.js
+++ b/jstests/sharding/change_streams/resume_change_stream.js
@@ -59,7 +59,7 @@ function testResume(mongosColl, collToWatch) {
assert.commandWorked(mongosColl.update({_id: -1}, {$set: {updated: true}}));
// Record current time to resume a change stream later in the test.
- const resumeTimeFirstUpdate = mongosDB.runCommand({isMaster: 1}).$clusterTime.clusterTime;
+ const resumeTimeFirstUpdate = mongosDB.runCommand({hello: 1}).$clusterTime.clusterTime;
assert.commandWorked(mongosColl.update({_id: 1}, {$set: {updated: true}}));
diff --git a/jstests/sharding/features2.js b/jstests/sharding/features2.js
index e3203a9d472..9626392a43f 100644
--- a/jstests/sharding/features2.js
+++ b/jstests/sharding/features2.js
@@ -157,25 +157,25 @@ db.countaa.save({"regex": /foo/i});
assert.eq(3, db.countaa.count(), "counta1");
assert.eq(3, db.countaa.find().itcount(), "counta1");
-// isMaster and query-wrapped-command
-let isMaster = db.runCommand({isMaster: 1});
-assert(isMaster.ismaster);
-assert.eq('isdbgrid', isMaster.msg);
-delete isMaster.localTime;
-delete isMaster.$clusterTime;
-delete isMaster.operationTime;
-
-let im2 = db.runCommand({query: {isMaster: 1}});
-delete im2.localTime;
-delete im2.$clusterTime;
-delete im2.operationTime;
-assert.eq(isMaster, im2);
-
-im2 = db.runCommand({$query: {isMaster: 1}});
-delete im2.localTime;
-delete im2.$clusterTime;
-delete im2.operationTime;
-assert.eq(isMaster, im2);
+// hello and query-wrapped-command
+let hello = db.runCommand({hello: 1});
+assert(hello.isWritablePrimary);
+assert.eq('isdbgrid', hello.msg);
+delete hello.localTime;
+delete hello.$clusterTime;
+delete hello.operationTime;
+
+let hello2 = db.runCommand({query: {hello: 1}});
+delete hello2.localTime;
+delete hello2.$clusterTime;
+delete hello2.operationTime;
+assert.eq(hello, hello2);
+
+hello2 = db.runCommand({$query: {hello: 1}});
+delete hello2.localTime;
+delete hello2.$clusterTime;
+delete hello2.operationTime;
+assert.eq(hello, hello2);
s.stop();
})();
diff --git a/jstests/sharding/key_rotation.js b/jstests/sharding/key_rotation.js
index da969e087f5..2c3dafebea3 100644
--- a/jstests/sharding/key_rotation.js
+++ b/jstests/sharding/key_rotation.js
@@ -33,7 +33,7 @@ startupKeys.toArray().forEach(function(key, i) {
// Verify there is a $clusterTime with a signature in the response.
jsTestLog("Verify a signature is included in the cluster time in a response.");
-let res = assert.commandWorked(st.s.getDB("test").runCommand({isMaster: 1}));
+let res = assert.commandWorked(st.s.getDB("test").runCommand({hello: 1}));
assert.hasFields(res, ["$clusterTime"]);
assert.hasFields(res.$clusterTime, ["signature"]);
assert.hasFields(res.$clusterTime.signature, ["hash", "keyId"]);
@@ -69,7 +69,7 @@ st.rs0.stopSet(null /* signal */, true /* forRestart */);
st.rs0.startSet({restart: true});
// The shard primary should return a dummy signed cluster time, because there are no keys.
-res = assert.commandWorked(st.rs0.getPrimary().getDB("test").runCommand({isMaster: 1}));
+res = assert.commandWorked(st.rs0.getPrimary().getDB("test").runCommand({hello: 1}));
assert.hasFields(res, ["$clusterTime", "operationTime"]);
assert.eq(res.$clusterTime.signature.keyId, NumberLong(0));
diff --git a/jstests/sharding/logical_time_api.js b/jstests/sharding/logical_time_api.js
index 98d59fb6e92..f13b396b2de 100644
--- a/jstests/sharding/logical_time_api.js
+++ b/jstests/sharding/logical_time_api.js
@@ -58,7 +58,7 @@ assert(containsValidLogicalTimeBson(res),
"replica set to contain logicalTime, received: " + tojson(res));
// Verify mongos can accept requests with $clusterTime in the command body.
-assert.commandWorked(testDB.runCommand({isMaster: 1, $clusterTime: res.$clusterTime}));
+assert.commandWorked(testDB.runCommand({hello: 1, $clusterTime: res.$clusterTime}));
// A mongod in a sharded replica set returns a logicalTime bson that matches the expected
// format.
@@ -69,7 +69,7 @@ assert(containsValidLogicalTimeBson(res),
"logicalTime, received: " + tojson(res));
// Verify mongod can accept requests with $clusterTime in the command body.
-res = assert.commandWorked(testDB.runCommand({isMaster: 1, $clusterTime: res.$clusterTime}));
+res = assert.commandWorked(testDB.runCommand({hello: 1, $clusterTime: res.$clusterTime}));
st.stop();
diff --git a/jstests/sharding/mongod_returns_no_cluster_time_without_keys.js b/jstests/sharding/mongod_returns_no_cluster_time_without_keys.js
index 2665415aab5..8417ddf3614 100644
--- a/jstests/sharding/mongod_returns_no_cluster_time_without_keys.js
+++ b/jstests/sharding/mongod_returns_no_cluster_time_without_keys.js
@@ -30,7 +30,7 @@ const timeoutValidLogicalTimeMs = 20 * 1000;
function assertContainsValidLogicalTime(adminConn) {
try {
- const res = adminConn.runCommand({isMaster: 1});
+ const res = adminConn.runCommand({hello: 1});
assert.hasFields(res, ["$clusterTime"]);
assert.hasFields(res.$clusterTime, ["signature", "clusterTime"]);
// clusterTime must be greater than the uninitialzed value.
@@ -94,7 +94,7 @@ st.rs0.startSet({restart: true});
priRSConn = st.rs0.getPrimary().getDB("admin");
priRSConn.auth(rUser.username, rUser.password);
-const resNoKeys = assert.commandWorked(priRSConn.runCommand({isMaster: 1}));
+const resNoKeys = assert.commandWorked(priRSConn.runCommand({hello: 1}));
priRSConn.logout();
assert.eq(resNoKeys.hasOwnProperty("$clusterTime"), false);
diff --git a/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js b/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js
index 69a64cd808d..b2429127041 100644
--- a/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js
+++ b/jstests/sharding/mongos_does_not_gossip_logical_time_without_keys.js
@@ -32,7 +32,7 @@ let st = new ShardingTest({shards: {rs0: {nodes: 2}}});
assert.soonNoExcept(function() {
assert(st.s.getDB("admin").system.keys.count() >= 2);
- let res = assert.commandWorked(st.s.getDB("test").runCommand({isMaster: 1}));
+ let res = assert.commandWorked(st.s.getDB("test").runCommand({hello: 1}));
assertContainsValidLogicalTime(res, false);
return true;
@@ -70,7 +70,7 @@ st.restartMongoses();
// Eventually mongos will discover the new keys, and start signing cluster times.
assert.soonNoExcept(function() {
- assertContainsValidLogicalTime(st.s.getDB("test").runCommand({isMaster: 1}), false);
+ assertContainsValidLogicalTime(st.s.getDB("test").runCommand({hello: 1}), false);
return true;
}, "expected mongos to eventually start signing cluster times", 60 * 1000); // 60 seconds.
diff --git a/jstests/sharding/mongos_no_replica_set_refresh.js b/jstests/sharding/mongos_no_replica_set_refresh.js
index b9080f950fc..218fc84a866 100644
--- a/jstests/sharding/mongos_no_replica_set_refresh.js
+++ b/jstests/sharding/mongos_no_replica_set_refresh.js
@@ -7,7 +7,7 @@ load("jstests/replsets/rslib.js");
var five_minutes = 5 * 60 * 1000;
var numRSHosts = function() {
- var result = assert.commandWorked(rsObj.nodes[0].adminCommand({ismaster: 1}));
+ var result = assert.commandWorked(rsObj.nodes[0].adminCommand({hello: 1}));
return result.hosts.length + result.passives.length;
};
diff --git a/jstests/sharding/mongos_quiesce_mode.js b/jstests/sharding/mongos_quiesce_mode.js
index 6b7a013b3ea..a68b07d31ab 100644
--- a/jstests/sharding/mongos_quiesce_mode.js
+++ b/jstests/sharding/mongos_quiesce_mode.js
@@ -1,7 +1,7 @@
/**
* Tests the behavior of quiesce mode on mongos, which is entered during shutdown.
* During quiesce mode, existing operations are allowed to continue and new operations are
- * accepted. However, isMaster requests return a ShutdownInProgress error, so that clients can
+ * accepted. However, hello requests return a ShutdownInProgress error, so that clients can
* begin re-routing operations.
* @tags: [
* requires_fcv_47,
@@ -33,9 +33,9 @@ function checkRemainingQuiesceTime(res) {
assert(res.hasOwnProperty("remainingQuiesceTimeMillis"), res);
}
-function runAwaitableIsMaster(topologyVersionField) {
+function runAwaitableHello(topologyVersionField) {
let res = assert.commandFailedWithCode(db.runCommand({
- isMaster: 1,
+ hello: 1,
topologyVersion: topologyVersionField,
maxAwaitTimeMS: 99999999,
}),
@@ -70,13 +70,12 @@ let insertCmdFailPoint = configureFailPoint(mongodPrimary, "hangAfterCollectionI
let insertCmd = startParallelShell(runInsert, mongodPrimary.port);
insertCmdFailPoint.wait();
-jsTestLog("Create a hanging isMaster via mongos.");
-res = assert.commandWorked(mongos.adminCommand({isMaster: 1}));
+jsTestLog("Create a hanging hello via mongos.");
+res = assert.commandWorked(mongos.adminCommand({hello: 1}));
assert(res.hasOwnProperty("topologyVersion"), res);
let topologyVersionField = res.topologyVersion;
let isMasterFailPoint = configureFailPoint(mongos, "waitForIsMasterResponse");
-let isMaster =
- startParallelShell(funWithArgs(runAwaitableIsMaster, topologyVersionField), mongos.port);
+let hello = startParallelShell(funWithArgs(runAwaitableHello, topologyVersionField), mongos.port);
isMasterFailPoint.wait();
assert.eq(1, mongos.getDB("admin").serverStatus().connections.awaitingTopologyChanges);
@@ -86,12 +85,11 @@ let quiesceModeFailPoint = configureFailPoint(mongos, "hangDuringQuiesceMode");
st.stopMongos(0 /* mongos index */, undefined /* opts */, {waitpid: false});
quiesceModeFailPoint.wait();
-jsTestLog("The waiting isMaster returns a ShutdownInProgress error.");
-isMaster();
+jsTestLog("The waiting hello returns a ShutdownInProgress error.");
+hello();
-jsTestLog("New isMaster command returns a ShutdownInProgress error.");
-res =
- assert.commandFailedWithCode(mongos.adminCommand({isMaster: 1}), ErrorCodes.ShutdownInProgress);
+jsTestLog("New hello command returns a ShutdownInProgress error.");
+res = assert.commandFailedWithCode(mongos.adminCommand({hello: 1}), ErrorCodes.ShutdownInProgress);
checkTopologyVersion(res, topologyVersionField);
checkRemainingQuiesceTime(res);
diff --git a/jstests/sharding/non_transaction_snapshot_errors.js b/jstests/sharding/non_transaction_snapshot_errors.js
index 38d5b583be8..875bea0f856 100644
--- a/jstests/sharding/non_transaction_snapshot_errors.js
+++ b/jstests/sharding/non_transaction_snapshot_errors.js
@@ -32,7 +32,7 @@ const kCommandTestCases = [
function runTest(st, numShardsToError, errorCode, isSharded) {
const db = st.s.getDB(dbName);
- const atClusterTime = st.s.adminCommand('ismaster').operationTime;
+ const atClusterTime = st.s.adminCommand('hello').operationTime;
for (let commandTestCase of kCommandTestCases) {
for (let readConcern of [{level: "snapshot"},
diff --git a/jstests/sharding/query/aggregation_currentop.js b/jstests/sharding/query/aggregation_currentop.js
index 615a177220f..01a9ad8d146 100644
--- a/jstests/sharding/query/aggregation_currentop.js
+++ b/jstests/sharding/query/aggregation_currentop.js
@@ -884,7 +884,7 @@ assert.commandFailedWithCode(
// Test that an operation which is at the BSON user size limit does not throw an error when the
// currentOp metadata is added to the output document.
-const bsonUserSizeLimit = assert.commandWorked(shardAdminDB.isMaster()).maxBsonObjectSize;
+const bsonUserSizeLimit = assert.commandWorked(shardAdminDB.hello()).maxBsonObjectSize;
let aggPipeline = [
{$currentOp: {}},
diff --git a/jstests/sharding/query/explain_read_pref.js b/jstests/sharding/query/explain_read_pref.js
index c3c51d85756..9bb6173817f 100644
--- a/jstests/sharding/query/explain_read_pref.js
+++ b/jstests/sharding/query/explain_read_pref.js
@@ -17,12 +17,12 @@ var assertCorrectTargeting = function(explain, isMongos, secExpected) {
}
var explainDestConn = new Mongo(serverInfo.host + ':' + serverInfo.port);
- var isMaster = explainDestConn.getDB('admin').runCommand({isMaster: 1});
+ var hello = explainDestConn.getDB('admin').runCommand({hello: 1});
if (secExpected) {
- assert(isMaster.secondary);
+ assert(hello.secondary);
} else {
- assert(isMaster.ismaster);
+ assert(hello.isWritablePrimary);
}
};
diff --git a/jstests/sharding/read_pref_cmd.js b/jstests/sharding/read_pref_cmd.js
index f94dd924f45..768b2a6fccc 100644
--- a/jstests/sharding/read_pref_cmd.js
+++ b/jstests/sharding/read_pref_cmd.js
@@ -99,9 +99,9 @@ let getNumNodesCmdRanOn = function(rsNodes, {dbName, profileQuery, expectedNode,
if (result != null) {
if (secOk && expectedNode == "secondary") {
- assert(profileDB.adminCommand({isMaster: 1}).secondary);
+ assert(profileDB.adminCommand({hello: 1}).secondary);
} else if (expectedNode == "primary") {
- assert(profileDB.adminCommand({isMaster: 1}).ismaster);
+ assert(profileDB.adminCommand({hello: 1}).isWritablePrimary);
}
numNodesCmdRanOn += 1;
}
diff --git a/jstests/sharding/server_status.js b/jstests/sharding/server_status.js
index 0e2865842b4..3c6bc24d1ce 100644
--- a/jstests/sharding/server_status.js
+++ b/jstests/sharding/server_status.js
@@ -21,12 +21,12 @@ var checkShardingServerStatus = function(doc) {
var configConnStr = shardingSection.configsvrConnectionString;
var configConn = new Mongo(configConnStr);
- var configIsMaster = configConn.getDB('admin').runCommand({isMaster: 1});
+ var configHello = configConn.getDB('admin').runCommand({hello: 1});
var configOpTimeObj = shardingSection.lastSeenConfigServerOpTime;
assert.gt(configConnStr.indexOf('/'), 0);
- assert.gte(configIsMaster.configsvr, 1); // If it's a shard, this field won't exist.
+ assert.gte(configHello.configsvr, 1); // If it's a shard, this field won't exist.
assert.neq(null, configOpTimeObj);
assert.neq(null, configOpTimeObj.ts);
assert.neq(null, configOpTimeObj.t);
diff --git a/jstests/sharding/shard_aware_init.js b/jstests/sharding/shard_aware_init.js
index ea5f350483b..cd764c840ce 100644
--- a/jstests/sharding/shard_aware_init.js
+++ b/jstests/sharding/shard_aware_init.js
@@ -9,10 +9,10 @@
(function() {
"use strict";
-var waitForMaster = function(conn) {
+var waitForPrimary = function(conn) {
assert.soon(function() {
- var res = conn.getDB('admin').runCommand({isMaster: 1});
- return res.ismaster;
+ var res = conn.getDB('admin').runCommand({hello: 1});
+ return res.isWritablePrimary;
});
};
@@ -55,7 +55,7 @@ var runTest = function(mongodConn, configConnStr, awaitVersionUpdate) {
delete options.replSet;
delete options.shardsvr;
var mongodConn = MongoRunner.runMongod(options);
- waitForMaster(mongodConn);
+ waitForPrimary(mongodConn);
var res = mongodConn.getDB('admin').system.version.update({_id: 'shardIdentity'},
shardIdentityDoc);
@@ -66,7 +66,7 @@ var runTest = function(mongodConn, configConnStr, awaitVersionUpdate) {
newMongodOptions.shardsvr = '';
newMongodOptions.replSet = rsName;
mongodConn = MongoRunner.runMongod(newMongodOptions);
- waitForMaster(mongodConn);
+ waitForPrimary(mongodConn);
res = mongodConn.getDB('admin').runCommand({shardingState: 1});
@@ -113,7 +113,7 @@ var runTest = function(mongodConn, configConnStr, awaitVersionUpdate) {
});
MongoRunner.stopMongod(mongodConn);
mongodConn = MongoRunner.runMongod(newMongodOptions);
- waitForMaster(mongodConn);
+ waitForPrimary(mongodConn);
res = mongodConn.getDB('admin').runCommand({shardingState: 1});
@@ -133,7 +133,7 @@ var runTest = function(mongodConn, configConnStr, awaitVersionUpdate) {
delete newMongodOptions.replSet;
delete newMongodOptions.shardsvr;
mongodConn = MongoRunner.runMongod(newMongodOptions);
- waitForMaster(mongodConn);
+ waitForPrimary(mongodConn);
let writeResult = assert.commandWorked(mongodConn.getDB('admin').system.version.update(
{_id: 'shardIdentity'}, {_id: 'shardIdentity', shardName: 'x', clusterId: ObjectId()}));
@@ -145,7 +145,7 @@ var runTest = function(mongodConn, configConnStr, awaitVersionUpdate) {
newMongodOptions.replSet = rsName;
assert.throws(function() {
var connToCrashedMongod = MongoRunner.runMongod(newMongodOptions);
- waitForMaster(connToCrashedMongod);
+ waitForPrimary(connToCrashedMongod);
});
// We call MongoRunner.stopMongod() using a former connection to the server that is
diff --git a/jstests/sharding/shard_aware_on_add_shard.js b/jstests/sharding/shard_aware_on_add_shard.js
index 68a0c871b88..75e2d7c1026 100644
--- a/jstests/sharding/shard_aware_on_add_shard.js
+++ b/jstests/sharding/shard_aware_on_add_shard.js
@@ -6,10 +6,10 @@
(function() {
"use strict";
-var waitForIsMaster = function(conn) {
+var waitForPrimary = function(conn) {
assert.soon(function() {
- var res = conn.getDB('admin').runCommand({isMaster: 1});
- return res.ismaster;
+ var res = conn.getDB('admin').runCommand({hello: 1});
+ return res.isWritablePrimary;
});
};
@@ -36,7 +36,7 @@ var clusterId = st.s.getDB('config').getCollection('version').findOne().clusterI
// Add a shard that is a standalone mongod.
var standaloneConn = MongoRunner.runMongod({shardsvr: ''});
-waitForIsMaster(standaloneConn);
+waitForPrimary(standaloneConn);
jsTest.log("Going to add standalone as shard: " + standaloneConn);
var newShardName = "newShard";
@@ -51,7 +51,7 @@ MongoRunner.stopMongod(standaloneConn);
var replTest = new ReplSetTest({nodes: 1});
replTest.startSet({shardsvr: ''});
replTest.initiate();
-waitForIsMaster(replTest.getPrimary());
+waitForPrimary(replTest.getPrimary());
jsTest.log("Going to add replica set as shard: " + tojson(replTest));
assert.commandWorked(st.s.adminCommand({addShard: replTest.getURL(), name: replTest.getURL()}));