summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/libs/override_methods/continuous_stepdown.js4
-rw-r--r--jstests/libs/retryable_writes_util.js2
-rw-r--r--jstests/noPassthrough/merge_out_on_secondary_fail_on_stepdown.js2
-rw-r--r--jstests/replsets/stepdown3.js2
-rw-r--r--src/mongo/base/error_codes.yml14
-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/client/streamable_replica_set_monitor_error_handler.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp2
-rw-r--r--src/mongo/db/lasterror.cpp6
-rw-r--r--src/mongo/db/lasterror.h6
-rw-r--r--src/mongo/db/repl/repl_client_info.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp6
-rw-r--r--src/mongo/db/s/move_primary_source_manager.cpp2
-rw-r--r--src/mongo/db/s/range_deletion_util.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.cpp11
-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
24 files changed, 54 insertions, 53 deletions
diff --git a/jstests/libs/override_methods/continuous_stepdown.js b/jstests/libs/override_methods/continuous_stepdown.js
index 72286c15f05..df11e5df873 100644
--- a/jstests/libs/override_methods/continuous_stepdown.js
+++ b/jstests/libs/override_methods/continuous_stepdown.js
@@ -382,7 +382,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;
@@ -390,7 +390,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/noPassthrough/merge_out_on_secondary_fail_on_stepdown.js b/jstests/noPassthrough/merge_out_on_secondary_fail_on_stepdown.js
index 1b8134f607d..135cdfcc6ab 100644
--- a/jstests/noPassthrough/merge_out_on_secondary_fail_on_stepdown.js
+++ b/jstests/noPassthrough/merge_out_on_secondary_fail_on_stepdown.js
@@ -48,7 +48,7 @@ let runTest = function(writeStage, failpoint) {
});
assert.commandFailed(cmdRes);
- assert(ErrorCodes.isNotMasterError(cmdRes.code), cmdRes);
+ assert(ErrorCodes.isNotPrimaryError(cmdRes.code), cmdRes);
`;
// Enable the fail point to stop the aggregate.
diff --git a/jstests/replsets/stepdown3.js b/jstests/replsets/stepdown3.js
index 53f8029908b..fa3ec022eed 100644
--- a/jstests/replsets/stepdown3.js
+++ b/jstests/replsets/stepdown3.js
@@ -38,7 +38,7 @@ var awaitShell = startParallelShell(command, primary.port);
print("getlasterror; should return an error");
let result = primary.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.yml b/src/mongo/base/error_codes.yml
index d3836b0d5fc..8c355271195 100644
--- a/src/mongo/base/error_codes.yml
+++ b/src/mongo/base/error_codes.yml
@@ -3,11 +3,11 @@ error_categories:
- NetworkError
- NetworkTimeoutError
- Interruption
- # isNotMasterError() includes all codes that indicate that the node that received the request
+ # isNotPrimaryError() 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 happened. If you care about whether a write could have happened,check for individual
# codes.
- - NotMasterError
+ - NotPrimaryError
- StaleShardVersionError
- NeedRetargettingError
- WriteConcernError
@@ -223,7 +223,7 @@ error_codes:
- {code: 186,name: ClientMetadataCannotBeMutated}
- {code: 187,name: LinearizableReadConcernError}
- {code: 188,name: IncompatibleServerVersion}
- - {code: 189,name: PrimarySteppedDown,categories: [NotMasterError,RetriableError]}
+ - {code: 189,name: PrimarySteppedDown,categories: [NotPrimaryError,RetriableError]}
- {code: 190,name: MasterSlaveConnectionFailure}
- {code: 191,name: OBSOLETE_BalancerLostDistributedLock}
- {code: 192,name: FailPointEnabled}
@@ -405,12 +405,12 @@ error_codes:
- {code: 9001,name: SocketException,categories: [NetworkError,RetriableError]}
- {code: 9996,name: OBSOLETE_RecvStaleConfig}
- {code: 10003,name: CannotGrowDocumentInCappedNamespace}
- - {code: 10107,name: NotWritablePrimary,categories: [NotMasterError,RetriableError]}
+ - {code: 10107,name: NotWritablePrimary,categories: [NotPrimaryError,RetriableError]}
- {code: 10334,name: BSONObjectTooLarge}
- {code: 11000,name: DuplicateKey,extra: DuplicateKeyErrorInfo}
- {code: 11600,name: InterruptedAtShutdown,categories: [Interruption,ShutdownError,CancelationError,RetriableError]}
- {code: 11601,name: Interrupted,categories: [Interruption]}
- - {code: 11602,name: InterruptedDueToReplStateChange,categories: [Interruption,NotMasterError,RetriableError]}
+ - {code: 11602,name: InterruptedDueToReplStateChange,categories: [Interruption,NotPrimaryError,RetriableError]}
- {code: 12586,name: BackgroundOperationInProgressForDatabase}
- {code: 12587,name: BackgroundOperationInProgressForNamespace}
- {code: 13104,name: OBSOLETE_PrepareConfigsFailed}
@@ -419,8 +419,8 @@ error_codes:
- {code: 13388,name: StaleConfig,
extra: StaleConfigInfo,
categories: [StaleShardVersionError,NeedRetargettingError]}
- - {code: 13435,name: NotPrimaryNoSecondaryOk,categories: [NotMasterError,RetriableError]}
- - {code: 13436,name: NotPrimaryOrSecondary,categories: [NotMasterError,RetriableError]}
+ - {code: 13435,name: NotPrimaryNoSecondaryOk,categories: [NotPrimaryError,RetriableError]}
+ - {code: 13436,name: NotPrimaryOrSecondary,categories: [NotPrimaryError,RetriableError]}
- {code: 14031,name: OutOfDiskSpace}
- {code: 17280,name: OBSOLETE_KeyTooLong}
- {code: 46841,name: ClientMarkedKilled,categories: [Interruption,CancelationError]}
diff --git a/src/mongo/client/dbclient_connection.cpp b/src/mongo/client/dbclient_connection.cpp
index a8b771be019..31e7f5117b8 100644
--- a/src/mongo/client/dbclient_connection.cpp
+++ b/src/mongo/client/dbclient_connection.cpp
@@ -812,7 +812,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 e6fddddb96e..d7b64bfc573 100644
--- a/src/mongo/client/remote_command_retry_scheduler_test.cpp
+++ b/src/mongo/client/remote_command_retry_scheduler_test.cpp
@@ -363,7 +363,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));
auto request = makeRemoteCommandRequest();
diff --git a/src/mongo/client/streamable_replica_set_monitor_error_handler.cpp b/src/mongo/client/streamable_replica_set_monitor_error_handler.cpp
index 73bc0a22ce9..ad48740c592 100644
--- a/src/mongo/client/streamable_replica_set_monitor_error_handler.cpp
+++ b/src/mongo/client/streamable_replica_set_monitor_error_handler.cpp
@@ -136,7 +136,7 @@ bool SdamErrorHandler::_isNotMasterOrNodeRecovering(const Status& status) const
}
bool SdamErrorHandler::_isNotMaster(const Status& status) const {
- return ErrorCodes::isA<ErrorCategory::NotMasterError>(status.code());
+ return ErrorCodes::isA<ErrorCategory::NotPrimaryError>(status.code());
}
int SdamErrorHandler::_getConsecutiveErrorsWithoutIsMasterOutcome(const HostAndPort& host) const {
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index e4a66da2d4b..0f3b83667cd 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -643,7 +643,7 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx,
}
}
throw;
- } catch (const ExceptionForCat<ErrorCategory::NotMasterError>& ex) {
+ } catch (const ExceptionForCat<ErrorCategory::NotPrimaryError>& ex) {
LOGV2(20444,
"Index build: received interrupt signal due to change in replication state",
"buildUUID"_attr = buildUUID,
diff --git a/src/mongo/db/lasterror.cpp b/src/mongo/db/lasterror.cpp
index 040bd399697..c81c7565ac9 100644
--- a/src/mongo/db/lasterror.cpp
+++ b/src/mongo/db/lasterror.cpp
@@ -68,8 +68,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) {
@@ -130,7 +130,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/repl_client_info.cpp b/src/mongo/db/repl/repl_client_info.cpp
index 21b6d0980ea..d72d8ca28c3 100644
--- a/src/mongo/db/repl/repl_client_info.cpp
+++ b/src/mongo/db/repl/repl_client_info.cpp
@@ -85,7 +85,7 @@ void ReplClientInfo::setLastOpToSystemLastOpTime(OperationContext* opCtx) {
systemOpTime = replCoord->getMyLastAppliedOpTime();
if (status == ErrorCodes::OplogOperationUnsupported ||
status == ErrorCodes::NamespaceNotFound ||
- status == ErrorCodes::CollectionIsEmpty || ErrorCodes::isNotMasterError(status)) {
+ status == ErrorCodes::CollectionIsEmpty || ErrorCodes::isNotPrimaryError(status)) {
// It is ok if the storage engine does not support getLatestOplogTimestamp() or
// if the oplog is empty. If the node stepped down in between, it is correct to
// use lastAppliedOpTime as last OpTime.
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 fa77f97b532..3cfe7be562b 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -830,7 +830,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(
@@ -874,7 +874,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.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index acbb071382d..0d715d6a0e5 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -1189,7 +1189,7 @@ void ReplicationCoordinatorImpl::signalDrainComplete(OperationContext* opCtx,
"Automatic reconfig to increment the config term on stepup failed",
"error"_attr = reconfigStatus);
// If the node stepped down after we released the lock, we can just return.
- if (ErrorCodes::isNotMasterError(reconfigStatus.code())) {
+ if (ErrorCodes::isNotPrimaryError(reconfigStatus.code())) {
return;
}
// Writing this new config with a new term is somewhat "best effort", and if we get
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
index 1a4c843523a..736e76d2368 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat_v1_test.cpp
@@ -1367,7 +1367,7 @@ Future<void> HBStepdownAndReconfigTest::startReconfigCommand() {
}
if (!status.isOK()) {
- ASSERT(ErrorCodes::isNotMasterError(status.code()));
+ ASSERT(ErrorCodes::isNotPrimaryError(status.code()));
LOGV2(463817,
"processReplSetReconfig threw expected error",
"errorCode"_attr = status.code(),
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index f19ee0d2bd0..0dd885073f9 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -632,7 +632,7 @@ TEST_F(ReplCoordTest, NodeReturnsImmediatelyWhenAwaitReplicationIsRanAgainstASta
ASSERT_OK(statusAndDur.status);
}
-TEST_F(ReplCoordTest, NodeReturnsNotMasterWhenRunningAwaitReplicationAgainstASecondaryNode) {
+TEST_F(ReplCoordTest, NodeReturnsNotPrimaryWhenRunningAwaitReplicationAgainstASecondaryNode) {
assertStartSuccess(BSON("_id"
<< "mySet"
<< "version" << 2 << "members"
@@ -1211,9 +1211,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/move_primary_source_manager.cpp b/src/mongo/db/s/move_primary_source_manager.cpp
index c096c24089d..8c2ff865e26 100644
--- a/src/mongo/db/s/move_primary_source_manager.cpp
+++ b/src/mongo/db/s/move_primary_source_manager.cpp
@@ -376,7 +376,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);
LOGV2_WARNING(22046,
diff --git a/src/mongo/db/s/range_deletion_util.cpp b/src/mongo/db/s/range_deletion_util.cpp
index 4ff6919fcd7..5f904e488ad 100644
--- a/src/mongo/db/s/range_deletion_util.cpp
+++ b/src/mongo/db/s/range_deletion_util.cpp
@@ -339,7 +339,7 @@ ExecutorFuture<void> deleteRangeInBatches(const std::shared_ptr<executor::TaskEx
swNumDeleted.getStatus() ==
ErrorCodes::RangeDeletionAbandonedBecauseTaskDocumentDoesNotExist ||
ErrorCodes::isShutdownError(swNumDeleted.getStatus()) ||
- ErrorCodes::isNotMasterError(swNumDeleted.getStatus());
+ ErrorCodes::isNotPrimaryError(swNumDeleted.getStatus());
})
.withDelayBetweenIterations(delayBetweenBatches)
.on(executor)
diff --git a/src/mongo/db/s/sharding_initialization_mongod.cpp b/src/mongo/db/s/sharding_initialization_mongod.cpp
index 0e0fb8d6de0..3c2bcd143e4 100644
--- a/src/mongo/db/s/sharding_initialization_mongod.cpp
+++ b/src/mongo/db/s/sharding_initialization_mongod.cpp
@@ -491,7 +491,7 @@ void ShardingInitializationMongoD::updateShardIdentityConfigString(
}
} catch (const DBException& exception) {
auto status = exception.toStatus();
- if (!ErrorCodes::isNotMasterError(status.code())) {
+ if (!ErrorCodes::isNotPrimaryError(status.code())) {
LOGV2_WARNING(22077,
"Error encountered while trying to update config connection string to "
"{newConnectionString} {error}",
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 4278c3367ff..ccb1d84d1c8 100644
--- a/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp
+++ b/src/mongo/db/s/transaction_coordinator_futures_util_test.cpp
@@ -683,7 +683,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 4ffb126939e..2b6d515148a 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -521,8 +521,9 @@ void appendErrorLabelsAndTopologyVersion(OperationContext* opCtx,
getErrorLabels(opCtx, sessionOptions, commandName, code, wcCode, isInternalClient);
commandBodyFieldsBob->appendElements(errorLabels);
- const auto isNotMasterError = (code && ErrorCodes::isA<ErrorCategory::NotMasterError>(*code)) ||
- (wcCode && ErrorCodes::isA<ErrorCategory::NotMasterError>(*wcCode));
+ const auto isNotPrimaryError =
+ (code && ErrorCodes::isA<ErrorCategory::NotPrimaryError>(*code)) ||
+ (wcCode && ErrorCodes::isA<ErrorCategory::NotPrimaryError>(*wcCode));
const auto isShutdownError = (code && ErrorCodes::isA<ErrorCategory::ShutdownError>(*code)) ||
(wcCode && ErrorCodes::isA<ErrorCategory::ShutdownError>(*wcCode));
@@ -534,7 +535,7 @@ void appendErrorLabelsAndTopologyVersion(OperationContext* opCtx,
// if the server enters quiesce mode.
const auto shouldAppendTopologyVersion =
(replCoord->getReplicationMode() == repl::ReplicationCoordinator::modeReplSet &&
- isNotMasterError) ||
+ isNotPrimaryError) ||
(isShutdownError && replCoord->inQuiesceMode());
if (!shouldAppendTopologyVersion) {
@@ -1476,7 +1477,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()) {
if (c && c->getReadWriteType() == Command::ReadWriteType::kWrite)
notMasterUnackWrites.increment();
uasserted(ErrorCodes::NotWritablePrimary,
@@ -1837,7 +1838,7 @@ DbResponse FireAndForgetOpRunner::run() {
// 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(hr->client()).hadNotMasterError()) {
+ if (LastError::get(hr->client()).hadNotPrimaryError()) {
notMasterLegacyUnackWrites.increment();
uasserted(ErrorCodes::NotWritablePrimary,
str::stream() << "Not-master error while processing '"
diff --git a/src/mongo/s/client/shard_remote.cpp b/src/mongo/s/client/shard_remote.cpp
index 6a381bf26d3..583fbc088fc 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 9681997c49d..d802d391010 100644
--- a/src/mongo/shell/session.js
+++ b/src/mongo/shell/session.js
@@ -325,7 +325,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 022593a7baf..0db644dd744 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>);
}