summaryrefslogtreecommitdiff
path: root/src/mongo/db/service_entry_point_mongod.cpp
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2018-09-19 15:01:04 -0400
committerHenrik Edin <henrik.edin@mongodb.com>2018-09-26 09:46:29 -0400
commit29ed53c6e1880b89adacdb292227dec57fb78fdc (patch)
tree7cbf32bd7aec50b1f6eaf950d6fa5b27054a194a /src/mongo/db/service_entry_point_mongod.cpp
parentaa952ac3b0d54d651f1cd8f618baee4fe0e10efa (diff)
downloadmongo-29ed53c6e1880b89adacdb292227dec57fb78fdc.tar.gz
SERVER-36084 Remove sharding runtime from ServiceEntryPointCommon and embedded build
Diffstat (limited to 'src/mongo/db/service_entry_point_mongod.cpp')
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp
index 488bdcba0bc..c0281fe7460 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -37,9 +37,16 @@
#include "mongo/db/curop.h"
#include "mongo/db/read_concern.h"
#include "mongo/db/repl/repl_client_info.h"
+#include "mongo/db/s/implicit_create_collection.h"
+#include "mongo/db/s/scoped_operation_completion_sharding_actions.h"
+#include "mongo/db/s/shard_filtering_metadata_refresh.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/logger/redaction.h"
#include "mongo/rpc/get_status_from_command_result.h"
+#include "mongo/s/cannot_implicitly_create_collection_info.h"
+#include "mongo/s/stale_exception.h"
#include "mongo/util/log.h"
namespace mongo {
@@ -117,6 +124,40 @@ public:
void attachCurOpErrInfo(OperationContext* opCtx, const BSONObj& replyObj) const override {
CurOp::get(opCtx)->debug().errInfo = getStatusFromCommandResult(replyObj);
}
+
+ void handleException(const DBException& e, OperationContext* opCtx) const override {
+ // 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();
+ }
+ }
+ }
+
+ void advanceConfigOptimeFromRequestMetadata(OperationContext* opCtx) const override {
+ // Handle config optime information that may have been sent along with the command.
+ rpc::advanceConfigOptimeFromRequestMetadata(opCtx);
+ }
+
+ std::unique_ptr<PolymorphicScoped> scopedOperationCompletionShardingActions(
+ OperationContext* opCtx) const override {
+ return std::make_unique<ScopedOperationCompletionShardingActions>(opCtx);
+ }
};
DbResponse ServiceEntryPointMongod::handleRequest(OperationContext* opCtx, const Message& m) {