diff options
author | Judah Schvimer <judah@mongodb.com> | 2019-05-20 16:10:46 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2019-05-20 16:10:46 -0400 |
commit | b205efb00fd6e9ce27646070e934983384e8c0e2 (patch) | |
tree | 76580416b9c78d4e3290c680907aebd350873a62 /src | |
parent | fae0c3f0fa4d5dfbe2f4fb03715b60e9ce3e2d93 (diff) | |
download | mongo-b205efb00fd6e9ce27646070e934983384e8c0e2.tar.gz |
SERVER-41216 Rename InterruptedDueToStepDown error code to InterruptedDueToReplStateChange
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/base/error_codes.err | 8 | ||||
-rw-r--r-- | src/mongo/client/remote_command_retry_scheduler.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/rollback_impl.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/rollback_impl_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/vote_requester_test.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/s/balancer/balancer.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/balancer/migration_manager.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/collection_range_deleter.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/metadata_manager.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/s/metadata_manager.h | 2 | ||||
-rw-r--r-- | src/mongo/db/s/shard_server_catalog_cache_loader.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/s/transaction_coordinator.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/transaction_router_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/shell/replsettest.js | 6 | ||||
-rw-r--r-- | src/mongo/shell/utils.js | 3 | ||||
-rw-r--r-- | src/mongo/util/assert_util_test.cpp | 30 |
19 files changed, 46 insertions, 46 deletions
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err index b34ac7c5c61..b870f1cd73a 100644 --- a/src/mongo/base/error_codes.err +++ b/src/mongo/base/error_codes.err @@ -279,7 +279,7 @@ error_code("UnsatisfiableCommitQuorum", 278) error_code("ClientDisconnect", 279) error_code("ChangeStreamFatalError", 280) # The two codes below are for internal use only and must never be returned in a network response -error_code("TransactionCoordinatorSteppingDown", 281) # Gets converted to InterruptedDueToStepDown +error_code("TransactionCoordinatorSteppingDown", 281) # Gets converted to InterruptedDueToReplStateChange error_code("TransactionCoordinatorReachedAbortDecision", 282) error_code("WouldChangeOwningShard", 283, extra="WouldChangeOwningShardInfo") error_code("ForTestingErrorExtraInfoWithExtraInfoInNamespace", 284, extra="nested::twice::NestedErrorExtraInfoExample") @@ -300,7 +300,7 @@ error_code("BSONObjectTooLarge", 10334) error_code("DuplicateKey", 11000, extra="DuplicateKeyErrorInfo") error_code("InterruptedAtShutdown", 11600) error_code("Interrupted", 11601) -error_code("InterruptedDueToStepDown", 11602) +error_code("InterruptedDueToReplStateChange", 11602) error_code("OutOfDiskSpace", 14031 ) # TODO SERVER-36385: Mark KeyTooLong error as obsolete error_code("KeyTooLong", 17280); @@ -318,7 +318,7 @@ error_code("MergeStageNoMatchingDocument", 13113); error_class("NetworkError", ["HostUnreachable", "HostNotFound", "NetworkTimeout", "SocketException"]) error_class("Interruption", ["Interrupted", "InterruptedAtShutdown", - "InterruptedDueToStepDown", + "InterruptedDueToReplStateChange", "ExceededTimeLimit", "MaxTimeMSExpired", "CursorKilled", @@ -332,7 +332,7 @@ error_class("NotMasterError", [ "NotMaster", "NotMasterNoSlaveOk", "NotMasterOrSecondary", - "InterruptedDueToStepDown", + "InterruptedDueToReplStateChange", "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 6ca796e1355..01e2a43f6b0 100644 --- a/src/mongo/client/remote_command_retry_scheduler.cpp +++ b/src/mongo/client/remote_command_retry_scheduler.cpp @@ -113,7 +113,7 @@ const std::initializer_list<ErrorCodes::Error> RemoteCommandRetryScheduler::kAll ErrorCodes::HostNotFound, ErrorCodes::NetworkTimeout, ErrorCodes::PrimarySteppedDown, - ErrorCodes::InterruptedDueToStepDown, + ErrorCodes::InterruptedDueToReplStateChange, ErrorCodes::BalancerInterrupted}; std::unique_ptr<RemoteCommandRetryScheduler::RetryPolicy> diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp index e64249ccbdb..dceb978a6f2 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -1874,9 +1874,8 @@ void ReplicationCoordinatorImpl::AutoGetRstlForStepUpStepDown::_killOpThreadFn() auto uniqueOpCtx = cc().makeOperationContext(); OperationContext* opCtx = uniqueOpCtx.get(); - // TODO: SERVER-41216 should change the error code as InterruptedDueToReplStateChange. // Set the reason for killing operations. - ErrorCodes::Error killReason = ErrorCodes::InterruptedDueToStepDown; + ErrorCodes::Error killReason = ErrorCodes::InterruptedDueToReplStateChange; while (true) { // Reset the value before killing user operations as we only want to track the number diff --git a/src/mongo/db/repl/rollback_impl.cpp b/src/mongo/db/repl/rollback_impl.cpp index 9df64211e44..3e1d8e50f21 100644 --- a/src/mongo/db/repl/rollback_impl.cpp +++ b/src/mongo/db/repl/rollback_impl.cpp @@ -295,7 +295,7 @@ void killAllUserOperations(OperationContext* opCtx) { } if (toKill && !toKill->isKillPending()) { - serviceCtx->killOperation(lk, toKill, ErrorCodes::NotMasterOrSecondary); + serviceCtx->killOperation(lk, toKill, ErrorCodes::InterruptedDueToReplStateChange); numOpsKilled++; } } diff --git a/src/mongo/db/repl/rollback_impl_test.cpp b/src/mongo/db/repl/rollback_impl_test.cpp index 122779a0214..becd52bd083 100644 --- a/src/mongo/db/repl/rollback_impl_test.cpp +++ b/src/mongo/db/repl/rollback_impl_test.cpp @@ -534,9 +534,9 @@ TEST_F(RollbackImplTest, RollbackKillsNecessaryOperations) { // We assume that an interrupted opCtx would release its locks. unittest::log() << "Both opCtx's marked for kill"; - ASSERT_EQ(ErrorCodes::NotMasterOrSecondary, writeOpCtx->checkForInterruptNoAssert()); + ASSERT_EQ(ErrorCodes::InterruptedDueToReplStateChange, writeOpCtx->checkForInterruptNoAssert()); globalWrite = boost::none; - ASSERT_EQ(ErrorCodes::NotMasterOrSecondary, readOpCtx->checkForInterruptNoAssert()); + ASSERT_EQ(ErrorCodes::InterruptedDueToReplStateChange, readOpCtx->checkForInterruptNoAssert()); globalRead = boost::none; unittest::log() << "Both opCtx's were interrupted"; diff --git a/src/mongo/db/repl/vote_requester_test.cpp b/src/mongo/db/repl/vote_requester_test.cpp index ab8525d026b..ca0bc29844e 100644 --- a/src/mongo/db/repl/vote_requester_test.cpp +++ b/src/mongo/db/repl/vote_requester_test.cpp @@ -163,7 +163,8 @@ protected: response.setVoteGranted(true); response.setTerm(1); response.addToBSON(&result); - auto status = Status(ErrorCodes::InterruptedDueToStepDown, "operation was interrupted"); + auto status = + Status(ErrorCodes::InterruptedDueToReplStateChange, "operation was interrupted"); CommandHelpers::appendCommandStatusNoThrow(result, status); return RemoteCommandResponse(result.obj(), Milliseconds(10)); } diff --git a/src/mongo/db/s/balancer/balancer.cpp b/src/mongo/db/s/balancer/balancer.cpp index 41655611bd3..43f924132aa 100644 --- a/src/mongo/db/s/balancer/balancer.cpp +++ b/src/mongo/db/s/balancer/balancer.cpp @@ -201,7 +201,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::InterruptedDueToStepDown); + _threadOperationContext->markKilled(ErrorCodes::InterruptedDueToReplStateChange); } // 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 8ce15436240..9c409334636 100644 --- a/src/mongo/db/s/balancer/migration_manager.cpp +++ b/src/mongo/db/s/balancer/migration_manager.cpp @@ -99,7 +99,7 @@ Status extractMigrationStatusFromCommandResponse(const BSONObj& commandResponse) bool isErrorDueToConfigStepdown(Status status, bool isStopping) { return ((status == ErrorCodes::CallbackCanceled && isStopping) || status == ErrorCodes::BalancerInterrupted || - status == ErrorCodes::InterruptedDueToStepDown); + status == ErrorCodes::InterruptedDueToReplStateChange); } } // namespace diff --git a/src/mongo/db/s/collection_range_deleter.cpp b/src/mongo/db/s/collection_range_deleter.cpp index f8cb571a14f..07ffd5adddb 100644 --- a/src/mongo/db/s/collection_range_deleter.cpp +++ b/src/mongo/db/s/collection_range_deleter.cpp @@ -93,7 +93,7 @@ CollectionRangeDeleter::CollectionRangeDeleter() = default; CollectionRangeDeleter::~CollectionRangeDeleter() { // Notify anybody still sleeping on orphan ranges - clear({ErrorCodes::InterruptedDueToStepDown, "Collection sharding metadata discarded"}); + clear({ErrorCodes::InterruptedDueToReplStateChange, "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 0d77fa131a2..a0145e9baea 100644 --- a/src/mongo/db/s/metadata_manager.cpp +++ b/src/mongo/db/s/metadata_manager.cpp @@ -224,7 +224,7 @@ MetadataManager::~MetadataManager() { void MetadataManager::_clearAllCleanups(WithLock lock) { _clearAllCleanups( lock, - {ErrorCodes::InterruptedDueToStepDown, + {ErrorCodes::InterruptedDueToReplStateChange, 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 9c7842386a1..4112d0fe4d8 100644 --- a/src/mongo/db/s/metadata_manager.h +++ b/src/mongo/db/s/metadata_manager.h @@ -176,7 +176,7 @@ private: /** * Cancels all scheduled deletions of orphan ranges, notifying listeners with status - * InterruptedDueToStepDown. + * InterruptedDueToReplStateChange. */ void _clearAllCleanups(WithLock); diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp index 51a6931c45d..9c4a2b9ab8c 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp @@ -407,7 +407,7 @@ std::shared_ptr<Notification<void>> ShardServerCatalogCacheLoader::getChunksSinc // began but before the OperationContext was added to the group. So we'll check // that we're still in the same _term. stdx::lock_guard<stdx::mutex> lock(_mutex); - uassert(ErrorCodes::InterruptedDueToStepDown, + uassert(ErrorCodes::InterruptedDueToReplStateChange, "Unable to refresh routing table because replica set state changed or " "the node is shutting down.", _term == term); @@ -457,7 +457,7 @@ void ShardServerCatalogCacheLoader::getDatabase( // we're still in the same _term. if (_term != currentTerm) { callbackFn(context.opCtx(), - Status{ErrorCodes::InterruptedDueToStepDown, + Status{ErrorCodes::InterruptedDueToReplStateChange, "Unable to refresh routing table because replica set state " "changed or node is shutting down."}); return; diff --git a/src/mongo/db/s/transaction_coordinator.cpp b/src/mongo/db/s/transaction_coordinator.cpp index 916dd01861e..e48938568c0 100644 --- a/src/mongo/db/s/transaction_coordinator.cpp +++ b/src/mongo/db/s/transaction_coordinator.cpp @@ -276,10 +276,10 @@ bool TransactionCoordinator::_reserveKickOffCommitPromise() { void TransactionCoordinator::_done(Status status) { // TransactionCoordinatorSteppingDown indicates the *sending* node (that is, *this* node) is // stepping down. Active coordinator tasks are interrupted with this code instead of - // InterruptedDueToStepDown, because InterruptedDueToStepDown indicates the *receiving* node was - // stepping down. + // InterruptedDueToReplStateChange, because InterruptedDueToReplStateChange indicates the + // *receiving* node was stepping down. if (status == ErrorCodes::TransactionCoordinatorSteppingDown) - status = Status(ErrorCodes::InterruptedDueToStepDown, + status = Status(ErrorCodes::InterruptedDueToReplStateChange, str::stream() << "Coordinator " << _lsid.getId() << ':' << _txnNumber << " stopped due to: " << status.reason()); diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index f9c38575808..132eed6f71b 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -791,7 +791,7 @@ void execCommandDatabase(OperationContext* opCtx, // We defer to individual commands to allow themselves to be interruptible by stepdowns, // since commands like 'voteRequest' should conversely continue executing. if (status != ErrorCodes::PrimarySteppedDown && - status != ErrorCodes::InterruptedDueToStepDown) { + status != ErrorCodes::InterruptedDueToReplStateChange) { uassertStatusOK(status); } 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 ae1c8b8ac5c..6ffc535bcb7 100644 --- a/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp +++ b/src/mongo/s/catalog/sharding_catalog_write_retry_test.cpp @@ -100,7 +100,7 @@ TEST_F(InsertRetryTest, RetryOnInterruptedAndNetworkErrorSuccess) { onCommand([&](const RemoteCommandRequest& request) { ASSERT_EQ(request.target, kTestHosts[0]); configTargeter()->setFindHostReturnValue({kTestHosts[1]}); - return Status(ErrorCodes::InterruptedDueToStepDown, "Interruption"); + return Status(ErrorCodes::InterruptedDueToReplStateChange, "Interruption"); }); onCommand([&](const RemoteCommandRequest& request) { @@ -488,7 +488,8 @@ TEST_F(UpdateRetryTest, OperationInterruptedDueToPrimaryStepDown) { auto writeErrDetail = stdx::make_unique<WriteErrorDetail>(); writeErrDetail->setIndex(0); - writeErrDetail->setStatus({ErrorCodes::InterruptedDueToStepDown, "Operation interrupted"}); + writeErrDetail->setStatus( + {ErrorCodes::InterruptedDueToReplStateChange, "Operation interrupted"}); response.addToErrDetails(writeErrDetail.release()); return response.toBSON(); diff --git a/src/mongo/s/transaction_router_test.cpp b/src/mongo/s/transaction_router_test.cpp index 2cff98f6174..031c131a2ef 100644 --- a/src/mongo/s/transaction_router_test.cpp +++ b/src/mongo/s/transaction_router_test.cpp @@ -83,7 +83,7 @@ protected: const Status kDummyStatus = {ErrorCodes::InternalError, "dummy"}; - const Status kDummyRetryableStatus = {ErrorCodes::InterruptedDueToStepDown, "dummy"}; + const Status kDummyRetryableStatus = {ErrorCodes::InterruptedDueToReplStateChange, "dummy"}; const BSONObj kDummyOkRes = BSON("ok" << 1); @@ -2467,7 +2467,7 @@ TEST_F(TransactionRouterTestWithDefaultSession, auto retryableError = [&] { BSONObjBuilder bob; CommandHelpers::appendCommandStatusNoThrow( - bob, Status(ErrorCodes::InterruptedDueToStepDown, "dummy")); + bob, Status(ErrorCodes::InterruptedDueToReplStateChange, "dummy")); return bob.obj(); }(); diff --git a/src/mongo/shell/replsettest.js b/src/mongo/shell/replsettest.js index 565fd3fb7b5..47b071385c4 100644 --- a/src/mongo/shell/replsettest.js +++ b/src/mongo/shell/replsettest.js @@ -939,7 +939,7 @@ var ReplSetTest = function(opts) { [ ErrorCodes.NodeNotFound, ErrorCodes.NewReplicaSetConfigurationIncompatible, - ErrorCodes.InterruptedDueToStepDown + ErrorCodes.InterruptedDueToReplStateChange ], errorMsg); return result.ok; @@ -982,8 +982,8 @@ var ReplSetTest = function(opts) { // replSetInitiate and replSetReconfig commands can fail with a NodeNotFound error 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 InterruptedDueToStepDown error when - // interrupted. We try several times, to reduce the chance of failing this way. + // stage while deducing isSelf(). This can fail with an InterruptedDueToReplStateChange + // error when interrupted. We try several times, to reduce the chance of failing this way. replSetCommandWithRetry(master, cmd); this.getPrimary(); // Blocks until there is a primary. diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index 5bdb70d549a..6d38633e11e 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -85,7 +85,7 @@ function isRetryableError(error) { const retryableErrors = [ "Interrupted", "InterruptedAtShutdown", - "InterruptedDueToStepDown", + "InterruptedDueToReplStateChange", "ExceededTimeLimit", "MaxTimeMSExpired", "CursorKilled", @@ -98,7 +98,6 @@ function isRetryableError(error) { "NotMaster", "NotMasterNoSlaveOk", "NotMasterOrSecondary", - "InterruptedDueToStepDown", "PrimarySteppedDown", "WriteConcernFailed", "WriteConcernLegacyOK", diff --git a/src/mongo/util/assert_util_test.cpp b/src/mongo/util/assert_util_test.cpp index 25516602071..25dcb159ba0 100644 --- a/src/mongo/util/assert_util_test.cpp +++ b/src/mongo/util/assert_util_test.cpp @@ -108,32 +108,32 @@ TEST(AssertUtils, UassertNamedCodeWithOneCategory) { ASSERT_NOT_CATCHES(ErrorCodes::NotMaster, ExceptionForCat<ErrorCategory::Interruption>); } -// InterruptedDueToStepDown - NotMasterError and Interruption +// InterruptedDueToReplStateChange - NotMasterError and Interruption MONGO_STATIC_ASSERT( std::is_same< - error_details::ErrorCategoriesFor<ErrorCodes::InterruptedDueToStepDown>, + error_details::ErrorCategoriesFor<ErrorCodes::InterruptedDueToReplStateChange>, error_details::CategoryList<ErrorCategory::Interruption, ErrorCategory::NotMasterError>>()); -MONGO_STATIC_ASSERT( - std::is_base_of<AssertionException, ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>()); +MONGO_STATIC_ASSERT(std::is_base_of<AssertionException, + ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>()); MONGO_STATIC_ASSERT(!std::is_base_of<ExceptionForCat<ErrorCategory::NetworkError>, - ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>()); + ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>()); MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::NotMasterError>, - ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>()); + ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>()); MONGO_STATIC_ASSERT(std::is_base_of<ExceptionForCat<ErrorCategory::Interruption>, - ExceptionFor<ErrorCodes::InterruptedDueToStepDown>>()); + ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>>()); TEST(AssertUtils, UassertNamedCodeWithTwoCategories) { - ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, DBException); - ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, AssertionException); - ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, - ExceptionFor<ErrorCodes::InterruptedDueToStepDown>); - ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToStepDown, + ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, DBException); + ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, AssertionException); + ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, + ExceptionFor<ErrorCodes::InterruptedDueToReplStateChange>); + ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, ExceptionFor<ErrorCodes::DuplicateKey>); - ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToStepDown, + ASSERT_NOT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, ExceptionForCat<ErrorCategory::NetworkError>); - ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, + ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, ExceptionForCat<ErrorCategory::NotMasterError>); - ASSERT_CATCHES(ErrorCodes::InterruptedDueToStepDown, + ASSERT_CATCHES(ErrorCodes::InterruptedDueToReplStateChange, ExceptionForCat<ErrorCategory::Interruption>); } |