summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/replsets/db_reads_while_recovering_all_commands.js26
-rw-r--r--jstests/replsets/initial_sync_test_fixture_test.js6
-rw-r--r--jstests/replsets/read_operations_during_rollback.js8
-rw-r--r--jstests/replsets/validate_fails_during_rollback.js4
-rw-r--r--src/mongo/base/error_codes.err6
-rw-r--r--src/mongo/client/dbclient_rs.cpp10
-rw-r--r--src/mongo/db/repl/replication_coordinator.h2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp4
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp2
-rw-r--r--src/mongo/db/s/balancer/migration_manager_test.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.cpp6
-rw-r--r--src/mongo/shell/utils.js2
12 files changed, 39 insertions, 39 deletions
diff --git a/jstests/replsets/db_reads_while_recovering_all_commands.js b/jstests/replsets/db_reads_while_recovering_all_commands.js
index 586adf96340..d95ee752995 100644
--- a/jstests/replsets/db_reads_while_recovering_all_commands.js
+++ b/jstests/replsets/db_reads_while_recovering_all_commands.js
@@ -72,7 +72,7 @@ const allCommands = {
aggregate: {
command: {aggregate: collName, pipeline: [{$match: {}}], cursor: {}},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
appendOplogNote: {skip: isPrimaryOnly},
applyOps: {skip: isPrimaryOnly},
@@ -89,7 +89,7 @@ const allCommands = {
collStats: {
command: {aggregate: collName, pipeline: [{$collStats: {count: {}}}], cursor: {}},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
commitTransaction: {skip: isPrimaryOnly},
compact: {skip: isNotAUserDataRead},
@@ -102,7 +102,7 @@ const allCommands = {
count: {
command: {count: collName},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
cpuload: {skip: isNotAUserDataRead},
create: {skip: isPrimaryOnly},
@@ -120,13 +120,13 @@ const allCommands = {
dbStats: {
command: {dbStats: 1},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
delete: {skip: isPrimaryOnly},
distinct: {
command: {distinct: collName, key: "a"},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
driverOIDTest: {skip: isNotAUserDataRead},
drop: {skip: isPrimaryOnly},
@@ -143,14 +143,14 @@ const allCommands = {
explain: {
command: {count: collName},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
features: {skip: isNotAUserDataRead},
filemd5: {skip: isNotAUserDataRead},
find: {
command: {find: collName, filter: {a: 1}},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
findAndModify: {skip: isPrimaryOnly},
flushRouterConfig: {skip: isNotAUserDataRead},
@@ -163,7 +163,7 @@ const allCommands = {
near: [-42, 42],
},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary
},
getCmdLineOpts: {skip: isNotAUserDataRead},
getDatabaseVersion: {skip: isNotAUserDataRead},
@@ -175,7 +175,7 @@ const allCommands = {
getMore: {
command: {getMore: NumberLong(123), collection: collName},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary
},
getParameter: {skip: isNotAUserDataRead},
getShardMap: {skip: isNotAUserDataRead},
@@ -200,19 +200,19 @@ const allCommands = {
listCollections: {
command: {listCollections: 1},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary
},
listCommands: {command: {listCommands: 1}},
listDatabases: {
command: {listDatabases: 1},
isAdminCommand: true,
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary
},
listIndexes: {
command: {listIndexes: collName},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary
},
lockInfo: {skip: isPrimaryOnly},
logApplicationMessage: {skip: isNotAUserDataRead},
@@ -228,7 +228,7 @@ const allCommands = {
out: {inline: 1}
},
expectFailure: true,
- expectedErrorCode: ErrorCodes.NotMasterOrSecondary,
+ expectedErrorCode: ErrorCodes.NotPrimaryOrSecondary,
},
"mapreduce.shardedfinish": {skip: isAnInternalCommand},
mergeChunks: {skip: isPrimaryOnly},
diff --git a/jstests/replsets/initial_sync_test_fixture_test.js b/jstests/replsets/initial_sync_test_fixture_test.js
index 7d7b2e93698..3ca8f17a709 100644
--- a/jstests/replsets/initial_sync_test_fixture_test.js
+++ b/jstests/replsets/initial_sync_test_fixture_test.js
@@ -81,7 +81,7 @@ secondary.setSlaveOk();
// Make sure that we cannot read from this node yet.
assert.commandFailedWithCode(secondary.getDB("test").runCommand({count: "foo"}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
// Make sure that we saw the listDatabases call in the log messages, but didn't see any
// listCollections or listIndexes call.
@@ -115,7 +115,7 @@ for (let dbObj of databases) {
// Make sure that we cannot read from this node yet.
assert.commandFailedWithCode(secondary.getDB("test").runCommand({count: "foo"}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
// Make sure that we saw the listCollections call in the log messages, but didn't see a
// listIndexes call.
@@ -131,7 +131,7 @@ for (let dbObj of databases) {
// Make sure that we cannot read from this node yet.
assert.commandFailedWithCode(secondary.getDB("test").runCommand({count: "foo"}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
// Make sure that we saw the listIndexes call in the log messages, but didn't
// see a listCollections call.
diff --git a/jstests/replsets/read_operations_during_rollback.js b/jstests/replsets/read_operations_during_rollback.js
index 322bf2e4905..c4ead83e2c8 100644
--- a/jstests/replsets/read_operations_during_rollback.js
+++ b/jstests/replsets/read_operations_during_rollback.js
@@ -64,20 +64,20 @@ joinGetMoreThread();
jsTestLog("Reading during rollback.");
// Make sure that read operations fail during rollback.
assert.commandFailedWithCode(rollbackNode.getDB(dbName).runCommand({"find": collName}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
assert.commandFailedWithCode(rollbackNode.getDB(dbName).runCommand(
{"getMore": cursorIdToBeReadDuringRollback, collection: collName}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
// Disable the best-effort check for primary-ness in the service entry point, so that we
// exercise the real check for primary-ness in 'find' and 'getMore' commands.
setFailPoint(rollbackNode, "skipCheckingForNotMasterInCommandDispatch");
jsTestLog("Reading during rollback (again with command dispatch checks disabled).");
assert.commandFailedWithCode(rollbackNode.getDB(dbName).runCommand({"find": collName}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
assert.commandFailedWithCode(rollbackNode.getDB(dbName).runCommand(
{"getMore": cursorIdToBeReadDuringRollback, collection: collName}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
clearFailPoint(rollbackNode, "rollbackHangAfterTransitionToRollback");
diff --git a/jstests/replsets/validate_fails_during_rollback.js b/jstests/replsets/validate_fails_during_rollback.js
index 5d8b8aff7df..7e73ab6de4f 100644
--- a/jstests/replsets/validate_fails_during_rollback.js
+++ b/jstests/replsets/validate_fails_during_rollback.js
@@ -25,9 +25,9 @@ rollbackTest.transitionToSyncSourceOperationsDuringRollback();
checkLog.contains(rollbackNode, "rollbackHangAfterTransitionToRollback fail point enabled.");
// Try to run the validate command on the rollback node. This should fail with a
-// NotMasterOrSecondary error.
+// NotPrimaryOrSecondary error.
assert.commandFailedWithCode(rollbackNode.getDB(dbName).runCommand({"validate": collName}),
- ErrorCodes.NotMasterOrSecondary);
+ ErrorCodes.NotPrimaryOrSecondary);
assert.commandWorked(rollbackNode.adminCommand(
{configureFailPoint: "rollbackHangAfterTransitionToRollback", mode: "off"}));
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err
index 891678251d9..2db76f7a5cf 100644
--- a/src/mongo/base/error_codes.err
+++ b/src/mongo/base/error_codes.err
@@ -313,7 +313,7 @@ error_code("OutOfDiskSpace", 14031 )
error_code("KeyTooLong", 17280);
error_code("BackgroundOperationInProgressForDatabase", 12586);
error_code("BackgroundOperationInProgressForNamespace", 12587);
-error_code("NotMasterOrSecondary", 13436);
+error_code("NotPrimaryOrSecondary", 13436);
error_code("NotPrimaryNoSecondaryOk", 13435);
error_code("ShardKeyTooBig", 13334);
error_code("StaleConfig", 13388, extra="StaleConfigInfo");
@@ -340,7 +340,7 @@ error_class("Interruption", ["Interrupted",
error_class("NotMasterError", [
"NotWritablePrimary",
"NotPrimaryNoSecondaryOk",
- "NotMasterOrSecondary",
+ "NotPrimaryOrSecondary",
"InterruptedDueToReplStateChange",
"PrimarySteppedDown",
])
@@ -376,7 +376,7 @@ error_class("NonResumableChangeStreamError", ["ChangeStreamFatalError", "ChangeS
error_class("RetriableError", [
"NotWritablePrimary",
"NotPrimaryNoSecondaryOk",
- "NotMasterOrSecondary",
+ "NotPrimaryOrSecondary",
"InterruptedDueToReplStateChange",
"PrimarySteppedDown",
"WriteConcernFailed",
diff --git a/src/mongo/client/dbclient_rs.cpp b/src/mongo/client/dbclient_rs.cpp
index 89d156c7abc..2588ef76fd5 100644
--- a/src/mongo/client/dbclient_rs.cpp
+++ b/src/mongo/client/dbclient_rs.cpp
@@ -656,11 +656,11 @@ unique_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult(
if (!isError)
return result;
- // We only check for "not master or secondary" errors here
+ // We only check for NotPrimaryOrSecondary errors here
// If the error code here ever changes, we need to change this code also
BSONElement code = error["code"];
- if (code.isNumber() && code.Int() == ErrorCodes::NotMasterOrSecondary) {
+ if (code.isNumber() && code.Int() == ErrorCodes::NotPrimaryOrSecondary) {
isntSecondary();
uasserted(14812,
str::stream() << "slave " << _lastSlaveOkHost.toString()
@@ -671,10 +671,10 @@ unique_ptr<DBClientCursor> DBClientReplicaSet::checkSlaveQueryResult(
}
void DBClientReplicaSet::isntSecondary() {
- // Failover to next slave
+ // Failover to next secondary
_getMonitor()->failedHost(
_lastSlaveOkHost,
- {ErrorCodes::NotMasterOrSecondary,
+ {ErrorCodes::NotPrimaryOrSecondary,
str::stream() << "slave no longer has secondary status: " << _lastSlaveOkHost});
resetSlaveOkConn();
@@ -885,7 +885,7 @@ void DBClientReplicaSet::checkResponse(const std::vector<BSONObj>& batch,
if (networkError ||
(hasErrField(dataObj) && !dataObj["code"].eoo() &&
- dataObj["code"].Int() == ErrorCodes::NotMasterOrSecondary)) {
+ dataObj["code"].Int() == ErrorCodes::NotPrimaryOrSecondary)) {
if (_lazyState._lastClient == _lastSlaveOkConn.get()) {
isntSecondary();
} else if (_lazyState._lastClient == _master.get()) {
diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h
index f32a88536e1..42ead8e2519 100644
--- a/src/mongo/db/repl/replication_coordinator.h
+++ b/src/mongo/db/repl/replication_coordinator.h
@@ -708,7 +708,7 @@ public:
* Returns Status::OK() if all updates are processed correctly, NodeNotFound
* if any updating node cannot be found in the config, InvalidReplicaSetConfig if the
* "configVersion" sent in any of the updates doesn't match our config version, or
- * NotMasterOrSecondary if we are in state REMOVED or otherwise don't have a valid
+ * NotPrimaryOrSecondary if we are in state REMOVED or otherwise don't have a valid
* replica set config.
* If a non-OK status is returned, it is unspecified whether none or some of the updates
* were applied.
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 8d8c93fbe2b..1a69efabf2e 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -2325,7 +2325,7 @@ Status ReplicationCoordinatorImpl::checkCanServeReadsFor_UNSAFE(OperationContext
stdx::lock_guard<Latch> lock(_mutex);
if ((_memberState.startup() && client->isFromUserConnection()) || _memberState.startup2() ||
_memberState.rollback()) {
- return Status{ErrorCodes::NotMasterOrSecondary,
+ return Status{ErrorCodes::NotPrimaryOrSecondary,
"Oplog collection reads are not allowed while in the rollback or "
"startup state."};
}
@@ -2346,7 +2346,7 @@ Status ReplicationCoordinatorImpl::checkCanServeReadsFor_UNSAFE(OperationContext
if (isPrimaryOrSecondary) {
return Status::OK();
}
- return Status(ErrorCodes::NotMasterOrSecondary,
+ return Status(ErrorCodes::NotPrimaryOrSecondary,
"not master or secondary; cannot currently read from this replSet member");
}
return Status(ErrorCodes::NotPrimaryNoSecondaryOk, "not master and slaveOk=false");
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index 2caaddd5c33..b9d622df06c 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -1067,7 +1067,7 @@ StatusWith<bool> TopologyCoordinator::setLastOptime(const UpdatePositionArgs::Up
long long* configVersion) {
if (_selfIndex == -1) {
// Ignore updates when we're in state REMOVED.
- return Status(ErrorCodes::NotMasterOrSecondary,
+ return Status(ErrorCodes::NotPrimaryOrSecondary,
"Received replSetUpdatePosition command but we are in state REMOVED");
}
invariant(_rsConfig.isInitialized()); // Can only use setLastOptime in replSet mode.
diff --git a/src/mongo/db/s/balancer/migration_manager_test.cpp b/src/mongo/db/s/balancer/migration_manager_test.cpp
index 44ba02a9e2b..418b28fe561 100644
--- a/src/mongo/db/s/balancer/migration_manager_test.cpp
+++ b/src/mongo/db/s/balancer/migration_manager_test.cpp
@@ -776,7 +776,7 @@ TEST_F(MigrationManagerTest, RemoteCallErrorConversionToOperationFailed) {
expectMoveChunkCommand(
chunk1,
kShardId1,
- Status(ErrorCodes::NotMasterOrSecondary,
+ Status(ErrorCodes::NotPrimaryOrSecondary,
"RemoteCallErrorConversionToOperationFailedCheck generated error."));
// Expect a moveChunk command that will fail with a replset monitor updating error.
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index 585274fdf9d..f949e00fb50 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -792,14 +792,14 @@ void execCommandDatabase(OperationContext* opCtx,
!replCoord->canAcceptWritesForDatabase_UNSAFE(opCtx, dbname) &&
!replCoord->getMemberState().secondary()) {
- uassert(ErrorCodes::NotMasterOrSecondary,
+ uassert(ErrorCodes::NotPrimaryOrSecondary,
"node is recovering",
!replCoord->getMemberState().recovering());
- uassert(ErrorCodes::NotMasterOrSecondary,
+ uassert(ErrorCodes::NotPrimaryOrSecondary,
"node is not in primary or recovering state",
replCoord->getMemberState().primary());
// Check ticket SERVER-21432, slaveOk commands are allowed in drain mode
- uassert(ErrorCodes::NotMasterOrSecondary,
+ uassert(ErrorCodes::NotPrimaryOrSecondary,
"node is in drain mode",
optedIn || alwaysAllowed);
}
diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js
index 09d16c9b944..2924487058a 100644
--- a/src/mongo/shell/utils.js
+++ b/src/mongo/shell/utils.js
@@ -97,7 +97,7 @@ function isRetryableError(error) {
"SocketException",
"NotWritablePrimary",
"NotPrimaryNoSecondaryOk",
- "NotMasterOrSecondary",
+ "NotPrimaryOrSecondary",
"PrimarySteppedDown",
"WriteConcernFailed",
"WriteConcernLegacyOK",