diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-04-02 17:16:03 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2019-04-03 10:26:36 -0400 |
commit | 8804404d94ccada2b1060b13f1ca7b9c24692178 (patch) | |
tree | c45462b0148d11b66a1f956f58497204db1385f4 /src/mongo | |
parent | d47bbc343af0b5bbde7b810f63e6b3404ea9e4d6 (diff) | |
download | mongo-8804404d94ccada2b1060b13f1ca7b9c24692178.tar.gz |
SERVER-39350 Make `opMsgRequestFromAnyProtocol` return owned request messages
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/s/transaction_coordinator_futures_util.h | 2 | ||||
-rw-r--r-- | src/mongo/rpc/factory.cpp | 2 | ||||
-rw-r--r-- | src/mongo/rpc/op_msg.h | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/mongo/db/s/transaction_coordinator_futures_util.h b/src/mongo/db/s/transaction_coordinator_futures_util.h index c7361906c2c..1b403d4704d 100644 --- a/src/mongo/db/s/transaction_coordinator_futures_util.h +++ b/src/mongo/db/s/transaction_coordinator_futures_util.h @@ -89,7 +89,7 @@ public: _activeOpContexts.begin(), tc->makeOperationContext()); ul.unlock(); - auto scopedGuard = makeGuard([&] { + ON_BLOCK_EXIT([&] { ul.lock(); _activeOpContexts.erase(uniqueOpCtxIter); // There is no need to call _notifyAllTasksComplete here, because we diff --git a/src/mongo/rpc/factory.cpp b/src/mongo/rpc/factory.cpp index 64bc5372142..475bcc6191e 100644 --- a/src/mongo/rpc/factory.cpp +++ b/src/mongo/rpc/factory.cpp @@ -71,7 +71,7 @@ std::unique_ptr<ReplyInterface> makeReply(const Message* unownedMessage) { OpMsgRequest opMsgRequestFromAnyProtocol(const Message& unownedMessage) { switch (unownedMessage.operation()) { case mongo::dbMsg: - return OpMsgRequest::parse(unownedMessage); + return OpMsgRequest::parseOwned(unownedMessage); case mongo::dbQuery: return opMsgRequestFromLegacyRequest(unownedMessage); default: diff --git a/src/mongo/rpc/op_msg.h b/src/mongo/rpc/op_msg.h index 86bfa8d130e..5983ed63226 100644 --- a/src/mongo/rpc/op_msg.h +++ b/src/mongo/rpc/op_msg.h @@ -123,6 +123,10 @@ struct OpMsgRequest : public OpMsg { return OpMsgRequest(OpMsg::parse(message)); } + static OpMsgRequest parseOwned(const Message& message) { + return OpMsgRequest(OpMsg::parseOwned(message)); + } + static OpMsgRequest fromDBAndBody(StringData db, BSONObj body, const BSONObj& extraFields = {}) { |