summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-08-26 13:45:37 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-30 14:31:38 +0000
commit8a82e657222fb2920c05aa0941f3e68aa191cd7d (patch)
treef4134f02b989a352c7aadf32d91eebbcea2801e3
parentcf080113fe8951ebb5a4795ad70494cbf5439493 (diff)
downloadmongo-8a82e657222fb2920c05aa0941f3e68aa191cd7d.tar.gz
SERVER-50409 Change NotMasterNoSlaveOk error name to NotPrimaryNoSecondaryOk
(cherry picked from commit b1920ea0a48a86bcd99eb5273ccbf12c008e4ed0) (cherry picked from commit 41b6e571e0ae8669b9bbd41f2a694535adeeb8d6)
-rw-r--r--jstests/multiVersion/agg_merge_upsert_supplied_cluster.js2
-rw-r--r--jstests/noPassthrough/replica_set_connection_stepdown.js2
-rw-r--r--jstests/replsets/drain.js8
-rw-r--r--jstests/replsets/secondaryOk_slaveOk_aliases.js4
-rw-r--r--jstests/replsets/slaveok_read_pref.js4
-rw-r--r--jstests/sharding/change_streams_update_lookup_shard_metadata_missing.js2
-rw-r--r--src/mongo/base/error_codes.err6
-rw-r--r--src/mongo/client/dbclient_rs.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.cpp2
-rw-r--r--src/mongo/shell/utils.js2
11 files changed, 18 insertions, 18 deletions
diff --git a/jstests/multiVersion/agg_merge_upsert_supplied_cluster.js b/jstests/multiVersion/agg_merge_upsert_supplied_cluster.js
index 1c7668a617c..292fa21eccb 100644
--- a/jstests/multiVersion/agg_merge_upsert_supplied_cluster.js
+++ b/jstests/multiVersion/agg_merge_upsert_supplied_cluster.js
@@ -9,7 +9,7 @@ load("jstests/multiVersion/libs/causal_consistency_helpers.js"); // supportsMaj
load("jstests/multiVersion/libs/multi_cluster.js"); // upgradeCluster
load("jstests/multiVersion/libs/multi_rs.js"); // upgradeSet
-// The UUID consistency check can hit NotMasterNoSlaveOk when it attempts to obtain a list of
+// The UUID consistency check can hit NotPrimaryNoSecondaryOk when it attempts to obtain a list of
// collections from the shard Primaries through mongoS at the end of this test.
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
diff --git a/jstests/noPassthrough/replica_set_connection_stepdown.js b/jstests/noPassthrough/replica_set_connection_stepdown.js
index 15fee060876..87b0709757e 100644
--- a/jstests/noPassthrough/replica_set_connection_stepdown.js
+++ b/jstests/noPassthrough/replica_set_connection_stepdown.js
@@ -41,7 +41,7 @@ const error = assert.throws(function() {
// throw if the ReplicaSetMonitor's backgroud refresh has already noticed that this node is
// no longer primary.
assert.commandFailedWithCode(rsConn.getDB("test").runCommand({find: "mycoll"}),
- ErrorCodes.NotMasterNoSlaveOk);
+ ErrorCodes.NotPrimaryNoSecondaryOk);
// However, once the server responds back with a "not master" error, DBClientRS will cause
// the ReplicaSetMonitor to attempt to discover the current primary, which will cause this
diff --git a/jstests/replsets/drain.js b/jstests/replsets/drain.js
index edd93644bce..8172988e866 100644
--- a/jstests/replsets/drain.js
+++ b/jstests/replsets/drain.js
@@ -65,15 +65,15 @@ jsTestLog('New primary should not be writable yet');
assert.writeError(secondary.getDB("foo").flag.insert({sentinel: 2}));
assert(!secondary.getDB("admin").runCommand({"isMaster": 1}).ismaster);
-// Ensure new primary is not yet readable without slaveOk bit.
+// Ensure new primary is not yet readable without secondaryOk bit.
secondary.setSecondaryOk(false);
-jsTestLog('New primary should not be readable yet, without slaveOk bit');
+jsTestLog('New primary should not be readable yet, without secondaryOk bit');
var res = secondary.getDB("foo").runCommand({find: "foo"});
assert.commandFailed(res);
-assert.eq(ErrorCodes.NotMasterNoSlaveOk,
+assert.eq(ErrorCodes.NotPrimaryNoSecondaryOk,
res.code,
"find failed with unexpected error code: " + tojson(res));
-// Nor should it be readable with the slaveOk bit.
+// Nor should it be readable with the secondaryOk bit.
secondary.setSecondaryOk();
assert.commandWorked(secondary.getDB("foo").runCommand({find: "foo"}));
diff --git a/jstests/replsets/secondaryOk_slaveOk_aliases.js b/jstests/replsets/secondaryOk_slaveOk_aliases.js
index 99a34d682ea..d0b9b95a8e3 100644
--- a/jstests/replsets/secondaryOk_slaveOk_aliases.js
+++ b/jstests/replsets/secondaryOk_slaveOk_aliases.js
@@ -25,7 +25,7 @@ assert.commandWorked(secondary.getDB(dbName).runCommand({find: collName}),
secondary.getDB(dbName).getMongo().setSecondaryOk(false);
assert.eq(secondary.getDB(dbName).getMongo().getSecondaryOk(), false);
assert.commandFailedWithCode(secondary.getDB(dbName).runCommand({find: collName}),
- ErrorCodes.NotMasterNoSlaveOk,
+ ErrorCodes.NotPrimaryNoSecondaryOk,
"find did not fail with the correct error code");
// setSlaveOk() is deprecated and aliased to setSecondaryOk(), but ensure
@@ -40,7 +40,7 @@ assert.commandWorked(secondary.getDB(dbName).runCommand({find: collName}),
secondary.getDB(dbName).getMongo().setSlaveOk(false);
assert.eq(secondary.getDB(dbName).getMongo().getSlaveOk(), false);
assert.commandFailedWithCode(secondary.getDB(dbName).runCommand({find: collName}),
- ErrorCodes.NotMasterNoSlaveOk,
+ ErrorCodes.NotPrimaryNoSecondaryOk,
"find did not fail with the correct error code");
rst.stopSet();
})();
diff --git a/jstests/replsets/slaveok_read_pref.js b/jstests/replsets/slaveok_read_pref.js
index 78b0139adfd..273924f16ee 100644
--- a/jstests/replsets/slaveok_read_pref.js
+++ b/jstests/replsets/slaveok_read_pref.js
@@ -37,9 +37,9 @@ for (let readMode of ["commands", "legacy"]) {
const cursor = (readPref ? secDB.test.find().readPref(readPref) : secDB.test.find());
if (readPref === "primary" || (!readPref && !slaveOk)) {
- // Attempting to run the query throws an error of type NotMasterNoSlaveOk.
+ // Attempting to run the query throws an error of type NotPrimaryNoSecondaryOk.
const slaveOkErr = assert.throws(() => cursor.itcount(), [], tojson(testType));
- assert.commandFailedWithCode(slaveOkErr, ErrorCodes.NotMasterNoSlaveOk);
+ assert.commandFailedWithCode(slaveOkErr, ErrorCodes.NotPrimaryNoSecondaryOk);
} else {
// Succeeds for all non-primary readPrefs, and for no readPref iff slaveOk.
const docCount = assert.doesNotThrow(() => cursor.itcount(), [], tojson(testType));
diff --git a/jstests/sharding/change_streams_update_lookup_shard_metadata_missing.js b/jstests/sharding/change_streams_update_lookup_shard_metadata_missing.js
index 562242f07e8..ca81f194204 100644
--- a/jstests/sharding/change_streams_update_lookup_shard_metadata_missing.js
+++ b/jstests/sharding/change_streams_update_lookup_shard_metadata_missing.js
@@ -9,7 +9,7 @@
load("jstests/multiVersion/libs/multi_cluster.js"); // For ShardingTest.waitUntilStable.
-// The UUID consistency check can hit NotMasterNoSlaveOk when it attempts to obtain a list of
+// The UUID consistency check can hit NotPrimaryNoSecondaryOk when it attempts to obtain a list of
// collections from the shard Primaries through mongoS at the end of this test.
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err
index ac4015ee47d..891678251d9 100644
--- a/src/mongo/base/error_codes.err
+++ b/src/mongo/base/error_codes.err
@@ -314,7 +314,7 @@ error_code("KeyTooLong", 17280);
error_code("BackgroundOperationInProgressForDatabase", 12586);
error_code("BackgroundOperationInProgressForNamespace", 12587);
error_code("NotMasterOrSecondary", 13436);
-error_code("NotMasterNoSlaveOk", 13435);
+error_code("NotPrimaryNoSecondaryOk", 13435);
error_code("ShardKeyTooBig", 13334);
error_code("StaleConfig", 13388, extra="StaleConfigInfo");
error_code("DatabaseDifferCase", 13297);
@@ -339,7 +339,7 @@ error_class("Interruption", ["Interrupted",
# happened. If you care about whether a write could have happened, check for individual codes.
error_class("NotMasterError", [
"NotWritablePrimary",
- "NotMasterNoSlaveOk",
+ "NotPrimaryNoSecondaryOk",
"NotMasterOrSecondary",
"InterruptedDueToReplStateChange",
"PrimarySteppedDown",
@@ -375,7 +375,7 @@ error_class("VoteAbortError", ["NoSuchTransaction", "ReadConcernMajorityNotEnabl
error_class("NonResumableChangeStreamError", ["ChangeStreamFatalError", "ChangeStreamHistoryLost"])
error_class("RetriableError", [
"NotWritablePrimary",
- "NotMasterNoSlaveOk",
+ "NotPrimaryNoSecondaryOk",
"NotMasterOrSecondary",
"InterruptedDueToReplStateChange",
"PrimarySteppedDown",
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index 59f7554608e..89d156c7abc 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -909,7 +909,7 @@ void DBClientReplicaSet::checkResponse(const std::vector<BSONObj>& batch,
if (networkError ||
(hasErrField(dataObj) && !dataObj["code"].eoo() &&
- dataObj["code"].Int() == ErrorCodes::NotMasterNoSlaveOk)) {
+ dataObj["code"].Int() == ErrorCodes::NotPrimaryNoSecondaryOk)) {
if (_lazyState._lastClient == _master.get()) {
isntMaster();
}
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 583aa452901..8d8c93fbe2b 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -2349,7 +2349,7 @@ Status ReplicationCoordinatorImpl::checkCanServeReadsFor_UNSAFE(OperationContext
return Status(ErrorCodes::NotMasterOrSecondary,
"not master or secondary; cannot currently read from this replSet member");
}
- return Status(ErrorCodes::NotMasterNoSlaveOk, "not master and slaveOk=false");
+ return Status(ErrorCodes::NotPrimaryNoSecondaryOk, "not master and slaveOk=false");
}
bool ReplicationCoordinatorImpl::isInPrimaryOrSecondaryState(OperationContext* opCtx) const {
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 6dfc0a5a4c3..585274fdf9d 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -778,7 +778,7 @@ void execCommandDatabase(OperationContext* opCtx,
couldHaveOptedIn && ReadPreferenceSetting::get(opCtx).canRunOnSecondary();
bool canRunHere = commandCanRunHere(opCtx, dbname, command, inMultiDocumentTransaction);
if (!canRunHere && couldHaveOptedIn) {
- uasserted(ErrorCodes::NotMasterNoSlaveOk, "not master and slaveOk=false");
+ uasserted(ErrorCodes::NotPrimaryNoSecondaryOk, "not master and slaveOk=false");
}
if (MONGO_FAIL_POINT(respondWithNotPrimaryInCommandDispatch)) {
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 31ddc54096e..09d16c9b944 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -96,7 +96,7 @@ function isRetryableError(error) {
"NetworkTimeout",
"SocketException",
"NotWritablePrimary",
- "NotMasterNoSlaveOk",
+ "NotPrimaryNoSecondaryOk",
"NotMasterOrSecondary",
"PrimarySteppedDown",
"WriteConcernFailed",