summaryrefslogtreecommitdiff
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
parent1b4b21a148c0a849693f5d3fcb18611893811e5e (diff)
downloadmongo-0ca1e56c5c045872e613f4a3ad68e40edfe66283.tar.gz
SERVER-34817 find replace from InterruptedDueToReplStateChange error code to InterruptedDueToStepDown
-rw-r--r--jstests/libs/override_methods/auto_retry_on_network_error.js4
-rw-r--r--jstests/noPassthrough/commands_preserve_exec_error_code.js2
-rw-r--r--jstests/noPassthrough/shell_retry_writes_on_retryable_errors.js2
-rw-r--r--jstests/replsets/linearizable_read_concern.js2
-rw-r--r--jstests/replsets/stepdown3.js2
-rw-r--r--jstests/replsets/write_concern_after_stepdown.js2
-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
18 files changed, 37 insertions, 39 deletions
diff --git a/jstests/libs/override_methods/auto_retry_on_network_error.js b/jstests/libs/override_methods/auto_retry_on_network_error.js
index 66a4ccc5ffc..842a6104047 100644
--- a/jstests/libs/override_methods/auto_retry_on_network_error.js
+++ b/jstests/libs/override_methods/auto_retry_on_network_error.js
@@ -149,7 +149,7 @@
// TODO SERVER-32208: Remove this function once it is no longer needed.
function isRetryableExecutorCodeAndMessage(code, msg) {
return code === ErrorCodes.OperationFailed && typeof msg !== "undefined" &&
- msg.indexOf("InterruptedDueToReplStateChange") >= 0;
+ msg.indexOf("InterruptedDueToStepDown") >= 0;
}
function runWithRetriesOnNetworkErrors(mongo, cmdObj, clientFunction, clientFunctionArguments) {
@@ -304,7 +304,7 @@
// Thrown when an index build is interrupted during its collection scan.
if (cmdName === "createIndexes" &&
- res.codeName === "InterruptedDueToReplStateChange") {
+ res.codeName === "InterruptedDueToStepDown") {
print("=-=-=-= Retrying because of interrupted collection scan: " +
cmdName + ", retries remaining: " + numRetries);
continue;
diff --git a/jstests/noPassthrough/commands_preserve_exec_error_code.js b/jstests/noPassthrough/commands_preserve_exec_error_code.js
index 548a40fb7d7..38e12da2740 100644
--- a/jstests/noPassthrough/commands_preserve_exec_error_code.js
+++ b/jstests/noPassthrough/commands_preserve_exec_error_code.js
@@ -1,6 +1,6 @@
// Tests that an error encountered during PlanExecutor execution will be propagated back to the user
// with the original error code. This is important for retryable errors like
-// 'InterruptedDueToReplStateChange',
+// 'InterruptedDueToStepDown',
// and also to ensure that the error is not swallowed and the diagnostic info is not lost.
(function() {
"use strict";
diff --git a/jstests/noPassthrough/shell_retry_writes_on_retryable_errors.js b/jstests/noPassthrough/shell_retry_writes_on_retryable_errors.js
index ca052915fe7..e4c3f8a8168 100644
--- a/jstests/noPassthrough/shell_retry_writes_on_retryable_errors.js
+++ b/jstests/noPassthrough/shell_retry_writes_on_retryable_errors.js
@@ -108,7 +108,7 @@
configureFailPoint: "onPrimaryTransactionalWrite",
data: {
closeConnection: false,
- failBeforeCommitExceptionCode: ErrorCodes.InterruptedDueToReplStateChange
+ failBeforeCommitExceptionCode: ErrorCodes.InterruptedDueToStepDown
},
mode: {times: 1}
});
diff --git a/jstests/replsets/linearizable_read_concern.js b/jstests/replsets/linearizable_read_concern.js
index da544cc9e55..01e639834a4 100644
--- a/jstests/replsets/linearizable_read_concern.js
+++ b/jstests/replsets/linearizable_read_concern.js
@@ -28,7 +28,7 @@ load('jstests/libs/write_concern_util.js');
assert.commandFailedWithCode(
coll.runCommand(
{'find': 'foo', readConcern: {level: "linearizable"}, maxTimeMS: 60000}),
- ErrorCodes.InterruptedDueToReplStateChange);
+ ErrorCodes.InterruptedDueToStepDown);
};
var num_nodes = 3;
diff --git a/jstests/replsets/stepdown3.js b/jstests/replsets/stepdown3.js
index cdce9057cd9..d125d7664f1 100644
--- a/jstests/replsets/stepdown3.js
+++ b/jstests/replsets/stepdown3.js
@@ -40,7 +40,7 @@
var result =
master.getDB("test").runCommand({getLastError: 1, w: 2, wtimeout: 10 * 60 * 1000});
if (result.errmsg === "not master" || result.code == ErrorCodes.NotMaster ||
- result.code == ErrorCodes.InterruptedDueToReplStateChange) {
+ result.code == ErrorCodes.InterruptedDueToStepDown) {
throw new Error("satisfy assert.throws()");
}
print("failed to throw exception; GLE returned: ");
diff --git a/jstests/replsets/write_concern_after_stepdown.js b/jstests/replsets/write_concern_after_stepdown.js
index c57331ecbba..f20e35e6e8c 100644
--- a/jstests/replsets/write_concern_after_stepdown.js
+++ b/jstests/replsets/write_concern_after_stepdown.js
@@ -57,7 +57,7 @@
writeConcern: {w: 'majority', wtimeout: 600000}
});
assert.writeErrorWithCode(
- res, [ErrorCodes.PrimarySteppedDown, ErrorCodes.InterruptedDueToReplStateChange]);
+ res, [ErrorCodes.PrimarySteppedDown, ErrorCodes.InterruptedDueToStepDown]);
};
var joinMajorityWriter = startParallelShell(doMajorityWrite, nodes[0].port);
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>);
}