From b762003b0b692fe78658e675f06495f132af442c Mon Sep 17 00:00:00 2001 From: Siyuan Zhou Date: Tue, 13 Mar 2018 19:50:49 -0400 Subject: SERVER-33591 Cleanup interaction of write concerns and transactions --- src/mongo/db/session.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mongo/db/session.cpp') diff --git a/src/mongo/db/session.cpp b/src/mongo/db/session.cpp index db36244520e..cd6106a1346 100644 --- a/src/mongo/db/session.cpp +++ b/src/mongo/db/session.cpp @@ -556,6 +556,8 @@ void Session::TxnResources::release(OperationContext* opCtx) { } void Session::stashTransactionResources(OperationContext* opCtx) { + invariant(opCtx->getTxnNumber()); + // We must lock the Client to change the Locker on the OperationContext and the Session mutex to // access Session state. We must lock the Client before the Session mutex, since the Client // effectively owns the Session. That is, a user might lock the Client to ensure it doesn't go @@ -602,6 +604,8 @@ void Session::stashTransactionResources(OperationContext* opCtx) { } void Session::unstashTransactionResources(OperationContext* opCtx) { + invariant(opCtx->getTxnNumber()); + // If the storage engine is mmapv1, it is not safe to lock both the Client and the Session // mutex. This is fine because mmapv1 does not support transactions. if (isMMAPV1()) { -- cgit v1.2.1