summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavi Vetriselvan <pavithra.vetriselvan@mongodb.com>2020-09-01 12:04:19 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-10-30 14:31:38 +0000
commitad5eb004b759726c712f5126ca593d3460e0b3ae (patch)
treed3e5bb8903e1ad11e50104defc0818d390f0cc04
parent307962d5aaaa80c492c78a773a8674215f3fcf30 (diff)
downloadmongo-ad5eb004b759726c712f5126ca593d3460e0b3ae.tar.gz
SERVER-50527 Change NotMasterError category to NotPrimaryError
(cherry picked from commit de38970c3b17250fd14ce83fb8a81d3f3e10bc69) (cherry picked from commit c78f57ddbc333923f6a3e9122ec84189b3ca810d)
-rw-r--r--jstests/libs/override_methods/continuous_stepdown.js4
-rw-r--r--jstests/libs/retryable_writes_util.js2
-rw-r--r--jstests/replsets/stepdown3.js2
-rw-r--r--src/mongo/base/error_codes.err6
-rw-r--r--src/mongo/base/transaction_error.cpp2
-rw-r--r--src/mongo/client/dbclient_connection.cpp2
-rw-r--r--src/mongo/client/remote_command_retry_scheduler_test.cpp2
-rw-r--r--src/mongo/db/lasterror.cpp6
-rw-r--r--src/mongo/db/lasterror.h6
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp6
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp2
-rw-r--r--src/mongo/db/s/move_primary_source_manager.cpp2
-rw-r--r--src/mongo/db/s/sharding_initialization_mongod.cpp2
-rw-r--r--src/mongo/db/s/transaction_coordinator_futures_util_test.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.cpp4
-rw-r--r--src/mongo/s/client/parallel.cpp2
-rw-r--r--src/mongo/s/client/shard_remote.cpp4
-rw-r--r--src/mongo/shell/session.js2
-rw-r--r--src/mongo/util/assert_util_test.cpp22
20 files changed, 42 insertions, 42 deletions
diff --git a/jstests/libs/override_methods/continuous_stepdown.js b/jstests/libs/override_methods/continuous_stepdown.js
index 894c274a26b..1107303a88f 100644
--- a/jstests/libs/override_methods/continuous_stepdown.js
+++ b/jstests/libs/override_methods/continuous_stepdown.js
@@ -372,7 +372,7 @@ ContinuousStepdown.configure = function(stepdownOptions,
try {
collInfo = db.getCollectionInfos();
} catch (e) {
- if (ErrorCodes.isNotMasterError(e.code)) {
+ if (ErrorCodes.isNotPrimaryError(e.code)) {
return false;
}
throw e;
@@ -380,7 +380,7 @@ ContinuousStepdown.configure = function(stepdownOptions,
collInfo.forEach(collDoc => {
const res = db.runCommand({collStats: collDoc["name"]});
- if (ErrorCodes.isNotMasterError(res.code)) {
+ if (ErrorCodes.isNotPrimaryError(res.code)) {
return false;
}
assert.commandWorked(res);
diff --git a/jstests/libs/retryable_writes_util.js b/jstests/libs/retryable_writes_util.js
index 664022e0693..5f037fc9db4 100644
--- a/jstests/libs/retryable_writes_util.js
+++ b/jstests/libs/retryable_writes_util.js
@@ -9,7 +9,7 @@ var RetryableWritesUtil = (function() {
* src/mongo/shell/session.js and use it here.
*/
function isRetryableCode(code) {
- return ErrorCodes.isNetworkError(code) || ErrorCodes.isNotMasterError(code) ||
+ return ErrorCodes.isNetworkError(code) || ErrorCodes.isNotPrimaryError(code) ||
ErrorCodes.isWriteConcernError(code) || ErrorCodes.isShutdownError(code) ||
ErrorCodes.isInterruption(code);
}
diff --git a/jstests/replsets/stepdown3.js b/jstests/replsets/stepdown3.js
index 508645cdf5a..3029b180fbe 100644
--- a/jstests/replsets/stepdown3.js
+++ b/jstests/replsets/stepdown3.js
@@ -38,7 +38,7 @@ var awaitShell = startParallelShell(command, master.port);
print("getlasterror; should return an error");
let result = master.getDB("test").runCommand({getLastError: 1, w: 2, wtimeout: 10 * 60 * 1000});
-assert(ErrorCodes.isNotMasterError(result.code));
+assert(ErrorCodes.isNotPrimaryError(result.code));
print("result of gle:");
printjson(result);
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err
index 2db76f7a5cf..3bcd42dc545 100644
--- a/src/mongo/base/error_codes.err
+++ b/src/mongo/base/error_codes.err
@@ -334,10 +334,10 @@ error_class("Interruption", ["Interrupted",
"ClientDisconnect",
"ClientMarkedKilled"])
-# isNotMasterError() includes all codes that indicate that the node that received the request was
-# not master at some point during command processing, regardless of whether some write may have
+# isNotPrimaryError() includes all codes that indicate that the node that received the request was
+# not primary at some point during command processing, regardless of whether some write may have
# happened. If you care about whether a write could have happened, check for individual codes.
-error_class("NotMasterError", [
+error_class("NotPrimaryError", [
"NotWritablePrimary",
"NotPrimaryNoSecondaryOk",
"NotPrimaryOrSecondary",
diff --git a/src/mongo/base/transaction_error.cpp b/src/mongo/base/transaction_error.cpp
index da395b64174..b9642e6f9ee 100644
--- a/src/mongo/base/transaction_error.cpp
+++ b/src/mongo/base/transaction_error.cpp
@@ -56,7 +56,7 @@ bool isTransientTransactionError(ErrorCodes::Error code,
} else {
// For commands other than "commitTransaction", we know there's no side-effect for these
// errors, but it's not true for "commitTransaction" if a failover happens.
- isTransient |= ErrorCodes::isNotMasterError(code) || ErrorCodes::isShutdownError(code) ||
+ isTransient |= ErrorCodes::isNotPrimaryError(code) || ErrorCodes::isShutdownError(code) ||
ErrorCodes::isNetworkError(code) || code == ErrorCodes::NoSuchTransaction;
}
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp
index d9db9692871..081ddf80202 100644
--- a/src/mongo/client/dbclient_connection.cpp
+++ b/src/mongo/client/dbclient_connection.cpp
@@ -689,7 +689,7 @@ void DBClientConnection::handleNotMasterResponse(const BSONObj& replyBody,
const BSONElement codeElem = replyBody["code"];
if (!isNotMasterErrorString(errorMsgElem) &&
- !ErrorCodes::isNotMasterError(ErrorCodes::Error(codeElem.numberInt()))) {
+ !ErrorCodes::isNotPrimaryError(ErrorCodes::Error(codeElem.numberInt()))) {
return;
}
diff --git a/src/mongo/client/remote_command_retry_scheduler_test.cpp b/src/mongo/client/remote_command_retry_scheduler_test.cpp
index ddc3574de1e..b92995d0fa9 100644
--- a/src/mongo/client/remote_command_retry_scheduler_test.cpp
+++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp
@@ -354,7 +354,7 @@ TEST_F(RemoteCommandRetrySchedulerTest,
TEST_F(RemoteCommandRetrySchedulerTest, SchedulerInvokesCallbackOnNonRetryableErrorInResponse) {
CallbackResponseSaver callback;
- auto policy = RemoteCommandRetryScheduler::makeRetryPolicy<ErrorCategory::NotMasterError>(
+ auto policy = RemoteCommandRetryScheduler::makeRetryPolicy<ErrorCategory::NotPrimaryError>(
10U, Milliseconds(1));
RemoteCommandRetryScheduler scheduler(
&getExecutor(), request, stdx::ref(callback), std::move(policy));
diff --git a/src/mongo/db/lasterror.cpp b/src/mongo/db/lasterror.cpp
index 837f3c5f209..8ae24575148 100644
--- a/src/mongo/db/lasterror.cpp
+++ b/src/mongo/db/lasterror.cpp
@@ -53,8 +53,8 @@ void LastError::setLastError(int code, std::string msg) {
_code = code;
_msg = std::move(msg);
- if (ErrorCodes::isNotMasterError(ErrorCodes::Error(_code)))
- _hadNotMasterError = true;
+ if (ErrorCodes::isNotPrimaryError(ErrorCodes::Error(_code)))
+ _hadNotPrimaryError = true;
}
void LastError::recordUpdate(bool updateObjects, long long nObjects, BSONObj upsertedId) {
@@ -113,7 +113,7 @@ void LastError::disable() {
void LastError::startRequest() {
_disabled = false;
++_nPrev;
- _hadNotMasterError = false;
+ _hadNotPrimaryError = false;
}
} // namespace mongo
diff --git a/src/mongo/db/lasterror.h b/src/mongo/db/lasterror.h
index 8fe17eeb5c0..1d4414f8865 100644
--- a/src/mongo/db/lasterror.h
+++ b/src/mongo/db/lasterror.h
@@ -86,8 +86,8 @@ public:
return _nPrev;
}
- bool hadNotMasterError() const {
- return _hadNotMasterError;
+ bool hadNotPrimaryError() const {
+ return _hadNotPrimaryError;
}
class Disabled {
@@ -119,7 +119,7 @@ private:
int _nPrev = 1;
bool _valid = false;
bool _disabled = false;
- bool _hadNotMasterError = false;
+ bool _hadNotPrimaryError = false;
};
} // namespace mongo
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index dd414df0b28..34303f125cb 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -766,7 +766,7 @@ void ReplicationCoordinatorExternalStateImpl::_shardingOnTransitionToPrimaryHook
// run the sharding onStepUp machinery. The onStepDown counterpart to these methods is
// already idempotent, so the machinery will remain in the stepped down state.
if (ErrorCodes::isShutdownError(status.code()) ||
- ErrorCodes::isNotMasterError(status.code())) {
+ ErrorCodes::isNotPrimaryError(status.code())) {
return;
}
fassertFailedWithStatus(
@@ -813,7 +813,7 @@ void ReplicationCoordinatorExternalStateImpl::_shardingOnTransitionToPrimaryHook
// the sharding onStepUp machinery. The onStepDown counterpart to these methods is already
// idempotent, so the machinery will remain in the stepped down state.
if (ErrorCodes::isShutdownError(status.code()) ||
- ErrorCodes::isNotMasterError(status.code())) {
+ ErrorCodes::isNotPrimaryError(status.code())) {
return;
}
fassert(40107, status);
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index a1d1d31ed87..42433a2756b 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -611,7 +611,7 @@ TEST_F(ReplCoordTest, NodeReturnsImmediatelyWhenAwaitReplicationIsRanAgainstASta
ASSERT_OK(statusAndDur.status);
}
-TEST_F(ReplCoordTest, NodeReturnsNotMasterWhenRunningAwaitReplicationAgainstASecondaryNode) {
+TEST_F(ReplCoordTest, NodeReturnsNotPrimaryWhenRunningAwaitReplicationAgainstASecondaryNode) {
assertStartSuccess(BSON("_id"
<< "mySet"
<< "version" << 2 << "members"
@@ -1188,9 +1188,9 @@ TEST_F(ReplCoordTest,
awaiter.reset();
}
-TEST_F(ReplCoordTest, NodeReturnsNotMasterWhenSteppingDownBeforeSatisfyingAWriteConcern) {
+TEST_F(ReplCoordTest, NodeReturnsNotPrimaryWhenSteppingDownBeforeSatisfyingAWriteConcern) {
// Test that a thread blocked in awaitReplication will be woken up and return PrimarySteppedDown
- // (a NotMasterError) if the node steps down while it is waiting.
+ // (a NotPrimaryError) if the node steps down while it is waiting.
assertStartSuccess(BSON("_id"
<< "mySet"
<< "version" << 2 << "members"
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp
index ab52ecb77fe..94b263313b7 100644
--- a/src/mongo/db/s/migration_source_manager.cpp
+++ b/src/mongo/db/s/migration_source_manager.cpp
@@ -632,7 +632,7 @@ void MigrationSourceManager::cleanupOnError(OperationContext* opCtx) {
try {
_cleanup(opCtx);
- } catch (const ExceptionForCat<ErrorCategory::NotMasterError>& ex) {
+ } catch (const ExceptionForCat<ErrorCategory::NotPrimaryError>& ex) {
warning() << "Failed to clean up migration: " << redact(_args.toString())
<< "due to: " << redact(ex);
}
diff --git a/src/mongo/db/s/move_primary_source_manager.cpp b/src/mongo/db/s/move_primary_source_manager.cpp
index be0a16193eb..b2af66a17d2 100644
--- a/src/mongo/db/s/move_primary_source_manager.cpp
+++ b/src/mongo/db/s/move_primary_source_manager.cpp
@@ -342,7 +342,7 @@ void MovePrimarySourceManager::cleanupOnError(OperationContext* opCtx) {
try {
_cleanup(opCtx);
- } catch (const ExceptionForCat<ErrorCategory::NotMasterError>& ex) {
+ } catch (const ExceptionForCat<ErrorCategory::NotPrimaryError>& ex) {
BSONObjBuilder requestArgsBSON;
_requestArgs.serialize(&requestArgsBSON);
warning() << "Failed to clean up movePrimary: " << redact(requestArgsBSON.obj())
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp
index a64b57b53ec..4f4a63fcfac 100644
--- a/src/mongo/db/s/sharding_initialization_mongod.cpp
+++ b/src/mongo/db/s/sharding_initialization_mongod.cpp
@@ -360,7 +360,7 @@ void ShardingInitializationMongoD::updateShardIdentityConfigString(
}
} catch (const DBException& exception) {
auto status = exception.toStatus();
- if (!ErrorCodes::isNotMasterError(status.code())) {
+ if (!ErrorCodes::isNotPrimaryError(status.code())) {
warning() << "Error encountered while trying to update config connection string to "
<< newConnectionString.toString() << causedBy(redact(status));
}
diff --git a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp
index 710b6c241af..ede4b93268f 100644
--- a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp
+++ b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp
@@ -684,7 +684,7 @@ TEST_F(AsyncWorkSchedulerTest, DoesNotNotifyRemoteCommandTargeter_CmdResponseOth
ASSERT_EQ(0UL, getShardTargeterMock(kShardIds[1])->getAndClearMarkedDownHosts().size());
}
-TEST_F(AsyncWorkSchedulerTest, NotifiesRemoteCommandTargeter_WCNotMasterError) {
+TEST_F(AsyncWorkSchedulerTest, NotifiesRemoteCommandTargeter_WCNotPrimaryError) {
ASSERT_EQ(0UL, getShardTargeterMock(kShardIds[1])->getAndClearMarkedDownHosts().size());
scheduleAWSRemoteCommandWithResponse(
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index f949e00fb50..a19e6e5ee68 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1073,7 +1073,7 @@ DbResponse receivedCommands(OperationContext* opCtx,
if (OpMsg::isFlagSet(message, OpMsg::kMoreToCome)) {
// Close the connection to get client to go through server selection again.
- if (LastError::get(opCtx->getClient()).hadNotMasterError()) {
+ if (LastError::get(opCtx->getClient()).hadNotPrimaryError()) {
notMasterUnackWrites.increment();
uasserted(ErrorCodes::NotWritablePrimary,
str::stream()
@@ -1404,7 +1404,7 @@ DbResponse ServiceEntryPointCommon::handleRequest(OperationContext* opCtx,
// receivedInsert/receivedUpdate/receivedDelete or within the AssertionException handler
// above. Either way, we want to throw an exception here, which will cause the client to be
// disconnected.
- if (LastError::get(opCtx->getClient()).hadNotMasterError()) {
+ if (LastError::get(opCtx->getClient()).hadNotPrimaryError()) {
notMasterLegacyUnackWrites.increment();
uasserted(ErrorCodes::NotWritablePrimary,
str::stream()
diff --git a/src/mongo/s/client/parallel.cpp b/src/mongo/s/client/parallel.cpp
index 85df5bf1720..0f53c472599 100644
--- a/src/mongo/s/client/parallel.cpp
+++ b/src/mongo/s/client/parallel.cpp
@@ -393,7 +393,7 @@ void ParallelSortClusteredCursor::setupVersionAndHandleSlaveOk(
} catch (const DBException& dbExcep) {
auto errCode = dbExcep.code();
if (allowShardVersionFailure &&
- (ErrorCodes::isNotMasterError(errCode) || ErrorCodes::isNetworkError(errCode) ||
+ (ErrorCodes::isNotPrimaryError(errCode) || ErrorCodes::isNetworkError(errCode) ||
errCode == ErrorCodes::FailedToSatisfyReadPreference)) {
// It's okay if we don't set the version when talking to a secondary, we can
// be stale in any case.
diff --git a/src/mongo/s/client/shard_remote.cpp b/src/mongo/s/client/shard_remote.cpp
index 3b59f3b98b8..e9d73d4e319 100644
--- a/src/mongo/s/client/shard_remote.cpp
+++ b/src/mongo/s/client/shard_remote.cpp
@@ -116,7 +116,7 @@ bool ShardRemote::isRetriableError(ErrorCodes::Error code, RetryPolicy options)
} break;
case RetryPolicy::kNotIdempotent: {
- return ErrorCodes::isNotMasterError(code);
+ return ErrorCodes::isNotPrimaryError(code);
} break;
}
@@ -133,7 +133,7 @@ void ShardRemote::updateReplSetMonitor(const HostAndPort& remoteHost,
if (remoteCommandStatus.isOK())
return;
- if (ErrorCodes::isNotMasterError(remoteCommandStatus.code())) {
+ if (ErrorCodes::isNotPrimaryError(remoteCommandStatus.code())) {
_targeter->markHostNotMaster(remoteHost, remoteCommandStatus);
} else if (ErrorCodes::isNetworkError(remoteCommandStatus.code())) {
_targeter->markHostUnreachable(remoteHost, remoteCommandStatus);
diff --git a/src/mongo/shell/session.js b/src/mongo/shell/session.js
index 4be01d2895e..3d056cefab6 100644
--- a/src/mongo/shell/session.js
+++ b/src/mongo/shell/session.js
@@ -330,7 +330,7 @@ var {
* source/retryable-writes/retryable-writes.rst#terms
*/
function isRetryableCode(code) {
- return ErrorCodes.isNetworkError(code) || ErrorCodes.isNotMasterError(code) ||
+ return ErrorCodes.isNetworkError(code) || ErrorCodes.isNotPrimaryError(code) ||
ErrorCodes.isShutdownError(code) || ErrorCodes.WriteConcernFailed === code;
}
diff --git a/src/mongo/util/assert_util_test.cpp b/src/mongo/util/assert_util_test.cpp
index f4ee8fa0629..ceff1888791 100644
--- a/src/mongo/util/assert_util_test.cpp
+++ b/src/mongo/util/assert_util_test.cpp
@@ -72,7 +72,7 @@ MONGO_STATIC_ASSERT(std::is_same<error_details::ErrorCategoriesFor<ErrorCodes::B
MONGO_STATIC_ASSERT(std::is_base_of<AssertionException, ExceptionFor<ErrorCodes::BadValue>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError>,
ExceptionFor<ErrorCodes::BadValue>>());
-MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NotMasterError>,
+MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NotPrimaryError>,
ExceptionFor<ErrorCodes::BadValue>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
ExceptionFor<ErrorCodes::BadValue>>());
@@ -83,19 +83,19 @@ TEST(AssertUtils, UassertNamedCodeWithoutCategories) {
ASSERT_CATCHES(ErrorCodes::BadValue, ExceptionFor<ErrorCodes::BadValue>);
ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionFor<ErrorCodes::DuplicateKey>);
ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::NetworkError>);
- ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::NotMasterError>);
+ ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::NotPrimaryError>);
ASSERT_NOT_CATCHES(ErrorCodes::BadValue, ExceptionForCat<ErrorCategory::Interruption>);
}
-// NotWritablePrimary - NotMasterError, RetriableError
+// NotWritablePrimary - NotPrimaryError, RetriableError
MONGO_STATIC_ASSERT(std::is_same<error_details::ErrorCategoriesFor<ErrorCodes::NotWritablePrimary>,
- error_details::CategoryList<ErrorCategory::NotMasterError,
+ error_details::CategoryList<ErrorCategory::NotPrimaryError,
ErrorCategory::RetriableError>>());
MONGO_STATIC_ASSERT(
std::is_base_of<AssertionException, ExceptionFor<ErrorCodes::NotWritablePrimary>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError>,
ExceptionFor<ErrorCodes::NotWritablePrimary>>());
-MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotMasterError>,
+MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotPrimaryError>,
ExceptionFor<ErrorCodes::NotWritablePrimary>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
ExceptionFor<ErrorCodes::NotWritablePrimary>>());
@@ -107,22 +107,22 @@ TEST(AssertUtils, UassertNamedCodeWithOneCategory) {
ASSERT_NOT_CATCHES(ErrorCodes::NotWritablePrimary, ExceptionFor<ErrorCodes::DuplicateKey>);
ASSERT_NOT_CATCHES(ErrorCodes::NotWritablePrimary,
ExceptionForCat<ErrorCategory::NetworkError>);
- ASSERT_CATCHES(ErrorCodes::NotWritablePrimary, ExceptionForCat<ErrorCategory::NotMasterError>);
+ ASSERT_CATCHES(ErrorCodes::NotWritablePrimary, ExceptionForCat<ErrorCategory::NotPrimaryError>);
ASSERT_NOT_CATCHES(ErrorCodes::NotWritablePrimary,
ExceptionForCat<ErrorCategory::Interruption>);
}
-// InterruptedDueToReplStateChange - NotMasterError, Interruption, RetriableError
+// InterruptedDueToReplStateChange - NotPrimaryError, Interruption, RetriableError
MONGO_STATIC_ASSERT(
std::is_same<error_details::ErrorCategoriesFor<ErrorCodes::InterruptedDueToReplStateChange>,
error_details::CategoryList<ErrorCategory::Interruption,
- ErrorCategory::NotMasterError,
+ ErrorCategory::NotPrimaryError,
ErrorCategory::RetriableError>>());
MONGO_STATIC_ASSERT(std::is_base_of<AssertionException,
ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError>,
ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
-MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotMasterError>,
+MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotPrimaryError>,
ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
@@ -137,7 +137,7 @@ TEST(AssertUtils, UassertNamedCodeWithTwoCategories) {
ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
ExceptionForCat<ErrorCategory::NetworkError>);
ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
- ExceptionForCat<ErrorCategory::NotMasterError>);
+ ExceptionForCat<ErrorCategory::NotPrimaryError>);
ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
ExceptionForCat<ErrorCategory::Interruption>);
}
@@ -150,7 +150,7 @@ TEST(AssertUtils, UassertNumericCode) {
ASSERT_CATCHES(19999, AssertionException);
ASSERT_NOT_CATCHES(19999, ExceptionFor<ErrorCodes::DuplicateKey>);
ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::NetworkError>);
- ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::NotMasterError>);
+ ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::NotPrimaryError>);
ASSERT_NOT_CATCHES(19999, ExceptionForCat<ErrorCategory::Interruption>);
}