summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/dbdirectclient.cpp2
-rw-r--r--src/mongo/db/op_msg_fuzzer.cpp2
-rw-r--r--src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp2
-rw-r--r--src/mongo/db/s/transaction_coordinator_futures_util.cpp2
-rw-r--r--src/mongo/db/service_entry_point_common.cpp11
-rw-r--r--src/mongo/db/service_entry_point_common.h5
-rw-r--r--src/mongo/db/service_entry_point_mongod.cpp3
-rw-r--r--src/mongo/db/service_entry_point_mongod.h3
8 files changed, 20 insertions, 10 deletions
diff --git a/src/mongo/db/dbdirectclient.cpp b/src/mongo/db/dbdirectclient.cpp
index ee58c8c31cb..5386bf567d2 100644
--- a/src/mongo/db/dbdirectclient.cpp
+++ b/src/mongo/db/dbdirectclient.cpp
@@ -143,7 +143,7 @@ DbResponse loopbackBuildResponse(OperationContext* const opCtx,
toSend.header().setId(nextMessageId());
toSend.header().setResponseToMsgId(0);
- return opCtx->getServiceContext()->getServiceEntryPoint()->handleRequest(opCtx, toSend);
+ return opCtx->getServiceContext()->getServiceEntryPoint()->handleRequest(opCtx, toSend).get();
}
} // namespace
diff --git a/src/mongo/db/op_msg_fuzzer.cpp b/src/mongo/db/op_msg_fuzzer.cpp
index 117027fc69b..9de41cd26ea 100644
--- a/src/mongo/db/op_msg_fuzzer.cpp
+++ b/src/mongo/db/op_msg_fuzzer.cpp
@@ -109,7 +109,7 @@ extern "C" int LLVMFuzzerTestOneInput(const char* Data, size_t Size) {
mongo::Message msg(std::move(sb));
try {
- serviceContext->getServiceEntryPoint()->handleRequest(opCtx.get(), msg);
+ serviceContext->getServiceEntryPoint()->handleRequest(opCtx.get(), msg).get();
} catch (const mongo::AssertionException&) {
// We need to catch exceptions caused by invalid inputs
}
diff --git a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp
index 2eba9258aa3..083015b10a9 100644
--- a/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp
+++ b/src/mongo/db/s/config/sharding_catalog_manager_collection_operations.cpp
@@ -177,6 +177,7 @@ Status updateConfigDocumentInTxn(OperationContext* opCtx,
->getServiceEntryPoint()
->handleRequest(opCtx,
OpMsgRequest::fromDBAndBody(nss.db().toString(), cmdObj).serialize())
+ .get()
.response);
return getStatusFromCommandResult(replyOpMsg.body);
@@ -221,6 +222,7 @@ Status commitTxnForConfigDocument(OperationContext* opCtx, TxnNumber txnNumber)
OpMsgRequest::fromDBAndBody(
NamespaceString::kAdminDb.toString(), cmdObj)
.serialize())
+ .get()
.response);
return getStatusFromCommandResult(replyOpMsg.body);
diff --git a/src/mongo/db/s/transaction_coordinator_futures_util.cpp b/src/mongo/db/s/transaction_coordinator_futures_util.cpp
index 4295c8ace08..3b43c5a4486 100644
--- a/src/mongo/db/s/transaction_coordinator_futures_util.cpp
+++ b/src/mongo/db/s/transaction_coordinator_futures_util.cpp
@@ -106,7 +106,7 @@ Future<executor::TaskExecutor::ResponseStatus> AsyncWorkScheduler::scheduleRemot
auto requestOpMsg =
OpMsgRequest::fromDBAndBody(NamespaceString::kAdminDb, commandObj).serialize();
const auto replyOpMsg = OpMsg::parseOwned(
- service->getServiceEntryPoint()->handleRequest(opCtx, requestOpMsg).response);
+ service->getServiceEntryPoint()->handleRequest(opCtx, requestOpMsg).get().response);
// Document sequences are not yet being used for responses.
invariant(replyOpMsg.sequences.empty());
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index d1554581e13..50b4d714d21 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -1645,9 +1645,9 @@ BSONObj ServiceEntryPointCommon::getRedactedCopyForLogging(const Command* comman
return bob.obj();
}
-DbResponse ServiceEntryPointCommon::handleRequest(OperationContext* opCtx,
- const Message& m,
- const Hooks& behaviors) {
+Future<DbResponse> ServiceEntryPointCommon::handleRequest(OperationContext* opCtx,
+ const Message& m,
+ const Hooks& behaviors) noexcept try {
// before we lock...
NetworkOp op = m.operation();
bool isCommand = false;
@@ -1790,7 +1790,10 @@ DbResponse ServiceEntryPointCommon::handleRequest(OperationContext* opCtx,
}
recordCurOpMetrics(opCtx);
- return dbresponse;
+ return Future<DbResponse>::makeReady(std::move(dbresponse));
+} catch (const DBException& e) {
+ LOGV2_ERROR(4879802, "Failed to handle request", "error"_attr = redact(e));
+ return e.toStatus();
}
ServiceEntryPointCommon::Hooks::~Hooks() = default;
diff --git a/src/mongo/db/service_entry_point_common.h b/src/mongo/db/service_entry_point_common.h
index 2fa1412c3b2..c122963bd44 100644
--- a/src/mongo/db/service_entry_point_common.h
+++ b/src/mongo/db/service_entry_point_common.h
@@ -35,6 +35,7 @@
#include "mongo/db/operation_context.h"
#include "mongo/rpc/message.h"
#include "mongo/util/fail_point.h"
+#include "mongo/util/future.h"
#include "mongo/util/polymorphic_scoped.h"
namespace mongo {
@@ -98,7 +99,9 @@ struct ServiceEntryPointCommon {
BSONObjBuilder* metadataBob) const = 0;
};
- static DbResponse handleRequest(OperationContext* opCtx, const Message& m, const Hooks& hooks);
+ static Future<DbResponse> handleRequest(OperationContext* opCtx,
+ const Message& m,
+ const Hooks& hooks) noexcept;
/**
* Produce a new object based on cmdObj, but with redactions applied as specified by
diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp
index b2b5bff551d..75b28b6595a 100644
--- a/src/mongo/db/service_entry_point_mongod.cpp
+++ b/src/mongo/db/service_entry_point_mongod.cpp
@@ -269,7 +269,8 @@ public:
}
};
-DbResponse ServiceEntryPointMongod::handleRequest(OperationContext* opCtx, const Message& m) {
+Future<DbResponse> ServiceEntryPointMongod::handleRequest(OperationContext* opCtx,
+ const Message& m) noexcept {
return ServiceEntryPointCommon::handleRequest(opCtx, m, Hooks{});
}
diff --git a/src/mongo/db/service_entry_point_mongod.h b/src/mongo/db/service_entry_point_mongod.h
index 57946da4d0e..a4fc691d408 100644
--- a/src/mongo/db/service_entry_point_mongod.h
+++ b/src/mongo/db/service_entry_point_mongod.h
@@ -42,7 +42,8 @@ class ServiceEntryPointMongod final : public ServiceEntryPointImpl {
public:
using ServiceEntryPointImpl::ServiceEntryPointImpl;
- DbResponse handleRequest(OperationContext* opCtx, const Message& request) override;
+ Future<DbResponse> handleRequest(OperationContext* opCtx,
+ const Message& request) noexcept override;
private:
class Hooks;