summaryrefslogtreecommitdiff
path: root/src/mongo/db/session.cpp
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2018-03-13 19:50:49 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2018-03-15 18:51:03 -0400
commitb762003b0b692fe78658e675f06495f132af442c (patch)
treeae6acbc0270ec93adfb8f9654ea830839b42dc6e /src/mongo/db/session.cpp
parentd0dea93d632ce451b66b57b538e66f3e1378b049 (diff)
downloadmongo-b762003b0b692fe78658e675f06495f132af442c.tar.gz
SERVER-33591 Cleanup interaction of write concerns and transactions
Diffstat (limited to 'src/mongo/db/session.cpp')
-rw-r--r--src/mongo/db/session.cpp4
1 files changed, 4 insertions, 0 deletions
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()) {