summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorNathan Louie <nathan.louie@10gen.com>2018-06-05 13:37:23 -0400
committerNathan Louie <nathan.louie@10gen.com>2018-06-06 09:43:38 -0400
commit0ca1e56c5c045872e613f4a3ad68e40edfe66283 (patch)
tree22f9c93a06676c3d262ceef4d169b20ce54bb538 /src/mongo
parent1b4b21a148c0a849693f5d3fcb18611893811e5e (diff)
downloadmongo-0ca1e56c5c045872e613f4a3ad68e40edfe66283.tar.gz
SERVER-34817 find replace from InterruptedDueToReplStateChange error code to InterruptedDueToStepDown
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/base/error_codes.err6
-rw-r--r--src/mongo/client/remote_command_retry_scheduler.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp2
-rw-r--r--src/mongo/db/repl/vote_requester_test.cpp3
-rw-r--r--src/mongo/db/s/balancer/balancer.cpp2
-rw-r--r--src/mongo/db/s/balancer/migration_manager.cpp2
-rw-r--r--src/mongo/db/s/collection_range_deleter.cpp2
-rw-r--r--src/mongo/db/s/metadata_manager.cpp2
-rw-r--r--src/mongo/db/s/metadata_manager.h2
-rw-r--r--src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp5
-rw-r--r--src/mongo/shell/replsettest.js4
-rw-r--r--src/mongo/util/assert_util_test.cpp30
12 files changed, 30 insertions, 32 deletions
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err
index b8236239438..beb81eadee6 100644
--- a/src/mongo/base/error_codes.err
+++ b/src/mongo/base/error_codes.err
@@ -270,7 +270,7 @@ error_code("BSONObjectTooLarge", 10334)
error_code("DuplicateKey", 11000)
error_code("InterruptedAtShutdown", 11600)
error_code("Interrupted", 11601)
-error_code("InterruptedDueToReplStateChange", 11602)
+error_code("InterruptedDueToStepDown", 11602)
error_code("OutOfDiskSpace", 14031 )
error_code("KeyTooLong", 17280);
error_code("BackgroundOperationInProgressForDatabase", 12586);
@@ -286,7 +286,7 @@ error_code("OBSOLETE_PrepareConfigsFailed", 13104);
error_class("NetworkError", ["HostUnreachable", "HostNotFound", "NetworkTimeout", "SocketException"])
error_class("Interruption", ["Interrupted",
"InterruptedAtShutdown",
- "InterruptedDueToReplStateChange",
+ "InterruptedDueToStepDown",
"ExceededTimeLimit",
"CursorKilled",
"LockTimeout"])
@@ -298,7 +298,7 @@ error_class("NotMasterError", [
"NotMaster",
"NotMasterNoSlaveOk",
"NotMasterOrSecondary",
- "InterruptedDueToReplStateChange",
+ "InterruptedDueToStepDown",
"PrimarySteppedDown",
])
error_class("StaleShardVersionError",
diff --git a/src/mongo/client/remote_command_retry_scheduler.cpp b/src/mongo/client/remote_command_retry_scheduler.cpp
index e9a0f07c9df..6af1934a303 100644
--- a/src/mongo/client/remote_command_retry_scheduler.cpp
+++ b/src/mongo/client/remote_command_retry_scheduler.cpp
@@ -112,7 +112,7 @@ const std::initializer_list<ErrorCodes::Error> RemoteCommandRetryScheduler::kAll
ErrorCodes::HostNotFound,
ErrorCodes::NetworkTimeout,
ErrorCodes::PrimarySteppedDown,
- ErrorCodes::InterruptedDueToReplStateChange,
+ ErrorCodes::InterruptedDueToStepDown,
ErrorCodes::BalancerInterrupted};
std::unique_ptr<RemoteCommandRetryScheduler::RetryPolicy>
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 acfaac392dd..1a1e4bbddd2 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -657,7 +657,7 @@ void ReplicationCoordinatorExternalStateImpl::closeConnections() {
void ReplicationCoordinatorExternalStateImpl::killAllUserOperations(OperationContext* opCtx) {
ServiceContext* environment = opCtx->getServiceContext();
- environment->killAllUserOperations(opCtx, ErrorCodes::InterruptedDueToReplStateChange);
+ environment->killAllUserOperations(opCtx, ErrorCodes::InterruptedDueToStepDown);
// Destroy all stashed transaction resources, in order to release locks.
SessionKiller::Matcher matcherAllSessions(
diff --git a/src/mongo/db/repl/vote_requester_test.cpp b/src/mongo/db/repl/vote_requester_test.cpp
index ad7501440a9..eaf8055c2a5 100644
--- a/src/mongo/db/repl/vote_requester_test.cpp
+++ b/src/mongo/db/repl/vote_requester_test.cpp
@@ -158,8 +158,7 @@ protected:
response.setVoteGranted(true);
response.setTerm(1);
response.addToBSON(&result);
- auto status =
- Status(ErrorCodes::InterruptedDueToReplStateChange, "operation was interrupted");
+ auto status = Status(ErrorCodes::InterruptedDueToStepDown, "operation was interrupted");
CommandHelpers::appendCommandStatusNoThrow(result, status);
return RemoteCommandResponse(result.obj(), BSONObj(), Milliseconds(10));
}
diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp
index 7873df3c4a1..db692af5c67 100644
--- a/src/mongo/db/s/balancer/balancer.cpp
+++ b/src/mongo/db/s/balancer/balancer.cpp
@@ -208,7 +208,7 @@ void Balancer::interruptBalancer() {
// context of that thread is still alive, because we hold the balancer mutex.
if (_threadOperationContext) {
stdx::lock_guard<Client> scopedClientLock(*_threadOperationContext->getClient());
- _threadOperationContext->markKilled(ErrorCodes::InterruptedDueToReplStateChange);
+ _threadOperationContext->markKilled(ErrorCodes::InterruptedDueToStepDown);
}
// Schedule a separate thread to shutdown the migration manager in order to avoid deadlock with
diff --git a/src/mongo/db/s/balancer/migration_manager.cpp b/src/mongo/db/s/balancer/migration_manager.cpp
index 267b7682f35..607f2635829 100644
--- a/src/mongo/db/s/balancer/migration_manager.cpp
+++ b/src/mongo/db/s/balancer/migration_manager.cpp
@@ -98,7 +98,7 @@ Status extractMigrationStatusFromCommandResponse(const BSONObj& commandResponse)
bool isErrorDueToConfigStepdown(Status status, bool isStopping) {
return ((status == ErrorCodes::CallbackCanceled && isStopping) ||
status == ErrorCodes::BalancerInterrupted ||
- status == ErrorCodes::InterruptedDueToReplStateChange);
+ status == ErrorCodes::InterruptedDueToStepDown);
}
} // namespace
diff --git a/src/mongo/db/s/collection_range_deleter.cpp b/src/mongo/db/s/collection_range_deleter.cpp
index 14aa772df4f..e10e53da9f3 100644
--- a/src/mongo/db/s/collection_range_deleter.cpp
+++ b/src/mongo/db/s/collection_range_deleter.cpp
@@ -86,7 +86,7 @@ CollectionRangeDeleter::CollectionRangeDeleter() = default;
CollectionRangeDeleter::~CollectionRangeDeleter() {
// Notify anybody still sleeping on orphan ranges
- clear({ErrorCodes::InterruptedDueToReplStateChange, "Collection sharding metadata discarded"});
+ clear({ErrorCodes::InterruptedDueToStepDown, "Collection sharding metadata discarded"});
}
boost::optional<Date_t> CollectionRangeDeleter::cleanUpNextRange(
diff --git a/src/mongo/db/s/metadata_manager.cpp b/src/mongo/db/s/metadata_manager.cpp
index 941772e0dac..39ebc67c567 100644
--- a/src/mongo/db/s/metadata_manager.cpp
+++ b/src/mongo/db/s/metadata_manager.cpp
@@ -171,7 +171,7 @@ MetadataManager::~MetadataManager() {
void MetadataManager::_clearAllCleanups(WithLock lock) {
_clearAllCleanups(
lock,
- {ErrorCodes::InterruptedDueToReplStateChange,
+ {ErrorCodes::InterruptedDueToStepDown,
str::stream() << "Range deletions in " << _nss.ns()
<< " abandoned because collection was dropped or became unsharded"});
}
diff --git a/src/mongo/db/s/metadata_manager.h b/src/mongo/db/s/metadata_manager.h
index 9fe3a813dea..573f89e465a 100644
--- a/src/mongo/db/s/metadata_manager.h
+++ b/src/mongo/db/s/metadata_manager.h
@@ -184,7 +184,7 @@ private:
/**
* Cancels all scheduled deletions of orphan ranges, notifying listeners with status
- * InterruptedDueToReplStateChange.
+ * InterruptedDueToStepDown.
*/
void _clearAllCleanups(WithLock);
diff --git a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
index 061d3bee333..6c71bb90d69 100644
--- a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
+++ b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp
@@ -94,7 +94,7 @@ TEST_F(InsertRetryTest, RetryOnInterruptedAndNetworkErrorSuccess) {
onCommand([&](const RemoteCommandRequest& request) {
ASSERT_EQ(request.target, kTestHosts[0]);
configTargeter()->setFindHostReturnValue({kTestHosts[1]});
- return Status(ErrorCodes::InterruptedDueToReplStateChange, "Interruption");
+ return Status(ErrorCodes::InterruptedDueToStepDown, "Interruption");
});
onCommand([&](const RemoteCommandRequest& request) {
@@ -482,8 +482,7 @@ TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) {
auto writeErrDetail = stdx::make_unique<WriteErrorDetail>();
writeErrDetail->setIndex(0);
- writeErrDetail->setStatus(
- {ErrorCodes::InterruptedDueToReplStateChange, "Operation interrupted"});
+ writeErrDetail->setStatus({ErrorCodes::InterruptedDueToStepDown, "Operation interrupted"});
response.addToErrDetails(writeErrDetail.release());
return response.toBSON();
diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js
index d5c615c9f46..c1794de9df8 100644
--- a/src/mongo/shell/replsettest.js
+++ b/src/mongo/shell/replsettest.js
@@ -909,7 +909,7 @@ var ReplSetTest = function(opts) {
// if a heartbeat times out during the quorum check.
// They may also fail with NewReplicaSetConfigurationIncompatible on similar timeout
// during the config validation stage while deducing isSelf().
- // This can fail with an InterruptedDueToReplStateChange error when interrupted.
+ // This can fail with an InterruptedDueToStepDown error when interrupted.
// We retry three times to reduce the chance of failing this way.
assert.retry(() => {
var res;
@@ -932,7 +932,7 @@ var ReplSetTest = function(opts) {
[
ErrorCodes.NodeNotFound,
ErrorCodes.NewReplicaSetConfigurationIncompatible,
- ErrorCodes.InterruptedDueToReplStateChange
+ ErrorCodes.InterruptedDueToStepDown
],
"replSetReconfig during initiate failed");
return false;
diff --git a/src/mongo/util/assert_util_test.cpp b/src/mongo/util/assert_util_test.cpp
index bf99f856563..360d534888d 100644
--- a/src/mongo/util/assert_util_test.cpp
+++ b/src/mongo/util/assert_util_test.cpp
@@ -107,32 +107,32 @@ TEST(AssertUtils, UassertNamedCodeWithOneCategory) {
ASSERT_NOT_CATCHES(ErrorCodes::NotMaster, ExceptionForCat<ErrorCategory::Interruption>);
}
-// InterruptedDueToReplStateChange - NotMasterError and Interruption
+// InterruptedDueToStepDown - NotMasterError and Interruption
MONGO_STATIC_ASSERT(
std::is_same<
- error_details::ErrorCategoriesFor<ErrorCodes::InterruptedDueToReplStateChange>,
+ error_details::ErrorCategoriesFor<ErrorCodes::InterruptedDueToStepDown>,
error_details::CategoryList<ErrorCategory::Interruption, ErrorCategory::NotMasterError>>());
-MONGO_STATIC_ASSERT(std::is_base_of<AssertionException,
- ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
+MONGO_STATIC_ASSERT(
+ std::is_base_of<AssertionException, ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>());
MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError>,
- ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
+ ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>());
MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotMasterError>,
- ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
+ ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>());
MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>,
- ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>());
+ ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>());
TEST(AssertUtils, UassertNamedCodeWithTwoCategories) {
- ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, DBException);
- ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, AssertionException);
- ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
- ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>);
- ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
+ ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, DBException);
+ ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, AssertionException);
+ ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown,
+ ExceptionFor<ErrorCodes::InterruptedDueToStepDown>);
+ ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToStepDown,
ExceptionFor<ErrorCodes::DuplicateKey>);
- ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
+ ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToStepDown,
ExceptionForCat<ErrorCategory::NetworkError>);
- ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
+ ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown,
ExceptionForCat<ErrorCategory::NotMasterError>);
- ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange,
+ ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown,
ExceptionForCat<ErrorCategory::Interruption>);
}