diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2018-09-19 15:01:04 -0400 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2018-09-26 09:46:29 -0400 |
commit | 29ed53c6e1880b89adacdb292227dec57fb78fdc (patch) | |
tree | 7cbf32bd7aec50b1f6eaf950d6fa5b27054a194a /src/mongo/db/service_entry_point_common.cpp | |
parent | aa952ac3b0d54d651f1cd8f618baee4fe0e10efa (diff) | |
download | mongo-29ed53c6e1880b89adacdb292227dec57fb78fdc.tar.gz |
SERVER-36084 Remove sharding runtime from ServiceEntryPointCommon and embedded build
Diffstat (limited to 'src/mongo/db/service_entry_point_common.cpp')
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 75d7f8b3071..8043df51d68 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -65,12 +65,8 @@ #include "mongo/db/repl/read_concern_args.h" #include "mongo/db/repl/repl_client_info.h" #include "mongo/db/repl/replication_coordinator.h" -#include "mongo/db/s/implicit_create_collection.h" #include "mongo/db/s/operation_sharding_state.h" -#include "mongo/db/s/scoped_operation_completion_sharding_actions.h" -#include "mongo/db/s/shard_filtering_metadata_refresh.h" #include "mongo/db/s/sharded_connection_info.h" -#include "mongo/db/s/sharding_config_optime_gossip.h" #include "mongo/db/s/sharding_state.h" #include "mongo/db/service_entry_point_common.h" #include "mongo/db/snapshot_window_util.h" @@ -89,9 +85,7 @@ #include "mongo/rpc/metadata/tracking_metadata.h" #include "mongo/rpc/op_msg.h" #include "mongo/rpc/reply_builder_interface.h" -#include "mongo/s/cannot_implicitly_create_collection_info.h" #include "mongo/s/grid.h" -#include "mongo/s/stale_exception.h" #include "mongo/util/fail_point_service.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -839,12 +833,11 @@ void execCommandDatabase(OperationContext* opCtx, uassertStatusOK(shardingState->canAcceptShardedCommands()); } - // Handle config optime information that may have been sent along with the command. - rpc::advanceConfigOptimeFromRequestMetadata(opCtx); + behaviors.advanceConfigOptimeFromRequestMetadata(opCtx); } oss.setAllowImplicitCollectionCreation(allowImplicitCollectionCreationField); - ScopedOperationCompletionShardingActions operationCompletionShardingActions(opCtx); + auto scoped = behaviors.scopedOperationCompletionShardingActions(opCtx); // This may trigger the maxTimeAlwaysTimeOut failpoint. auto status = opCtx->checkForInterruptNoAssert(); @@ -891,27 +884,7 @@ void execCommandDatabase(OperationContext* opCtx, throw; } } catch (const DBException& e) { - // If we got a stale config, wait in case the operation is stuck in a critical section - if (auto sce = e.extraInfo<StaleConfigInfo>()) { - if (!opCtx->getClient()->isInDirectClient()) { - // We already have the StaleConfig exception, so just swallow any errors due to - // refresh - onShardVersionMismatchNoExcept(opCtx, sce->getNss(), sce->getVersionReceived()) - .ignore(); - } - } else if (auto sce = e.extraInfo<StaleDbRoutingVersion>()) { - if (!opCtx->getClient()->isInDirectClient()) { - onDbVersionMismatchNoExcept( - opCtx, sce->getDb(), sce->getVersionReceived(), sce->getVersionWanted()) - .ignore(); - } - } else if (auto cannotImplicitCreateCollInfo = - e.extraInfo<CannotImplicitlyCreateCollectionInfo>()) { - if (ShardingState::get(opCtx)->enabled()) { - onCannotImplicitlyCreateCollection(opCtx, cannotImplicitCreateCollInfo->getNss()) - .ignore(); - } - } else if (e.code() == ErrorCodes::SnapshotTooOld) { + if (e.code() == ErrorCodes::SnapshotTooOld) { // SnapshotTooOld errors indicate that PIT ops are failing to find an available snapshot // at their specified atClusterTime. Therefore, we'll try to increase the snapshot // history window that the storage engine maintains in order to increase the likelihood @@ -920,6 +893,8 @@ void execCommandDatabase(OperationContext* opCtx, if (engine && engine->supportsReadConcernSnapshot()) { SnapshotWindowUtil::increaseTargetSnapshotWindowSize(opCtx); } + } else { + behaviors.handleException(e, opCtx); } // Append the error labels for transient transaction errors. @@ -1059,7 +1034,8 @@ DbResponse receivedCommands(OperationContext* opCtx, DbResponse receivedQuery(OperationContext* opCtx, const NamespaceString& nss, Client& c, - const Message& m) { + const Message& m, + const ServiceEntryPointCommon::Hooks& behaviors) { invariant(!nss.isCommand()); globalOpCounters.gotQuery(); @@ -1077,15 +1053,7 @@ DbResponse receivedQuery(OperationContext* opCtx, dbResponse.exhaustNS = runQuery(opCtx, q, nss, dbResponse.response); } catch (const AssertionException& e) { - // If we got a stale config, wait in case the operation is stuck in a critical section - if (auto sce = e.extraInfo<StaleConfigInfo>()) { - if (!opCtx->getClient()->isInDirectClient()) { - // We already have the StaleConfig exception, so just swallow any errors due to - // refresh - onShardVersionMismatchNoExcept(opCtx, sce->getNss(), sce->getVersionReceived()) - .ignore(); - } - } + behaviors.handleException(e, opCtx); dbResponse.response.reset(); generateLegacyQueryErrorResponse(e, q, &op, &dbResponse.response); @@ -1316,7 +1284,7 @@ DbResponse ServiceEntryPointCommon::handleRequest(OperationContext* opCtx, dbresponse = receivedCommands(opCtx, m, behaviors); } else if (op == dbQuery) { invariant(!isCommand); - dbresponse = receivedQuery(opCtx, nsString, c, m); + dbresponse = receivedQuery(opCtx, nsString, c, m, behaviors); } else if (op == dbGetMore) { dbresponse = receivedGetMore(opCtx, m, currentOp, &forceLog); } else { |