summaryrefslogtreecommitdiff
path: root/src/mongo/db/session_catalog.cpp
diff options
context:
space:
mode:
authorWilliam Schultz <william.schultz@mongodb.com>2018-04-04 17:08:04 -0400
committerWilliam Schultz <william.schultz@mongodb.com>2018-04-04 17:14:47 -0400
commit66c537372c0aa54819adb7f72c9eda6cf8750f8e (patch)
tree18411741fc99e04f2c9d89d2c61e70f22c1bbd3f /src/mongo/db/session_catalog.cpp
parent69005c338fe103892d2941791b12f5c06aae3394 (diff)
downloadmongo-66c537372c0aa54819adb7f72c9eda6cf8750f8e.tar.gz
SERVER-34051 Require autocommit=false on all transaction operations and add support
for 'startTransaction' argument This patch requires all operations that are part of a multi-statement transaction to specify an autocommit=false command argument. It also adds the 'startTransaction' command argument, which when specified as 'true' indicates that a command is the beginning of a multi-statement transaction.
Diffstat (limited to 'src/mongo/db/session_catalog.cpp')
-rw-r--r--src/mongo/db/session_catalog.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/session_catalog.cpp b/src/mongo/db/session_catalog.cpp
index 48869e4c338..d70b68da890 100644
--- a/src/mongo/db/session_catalog.cpp
+++ b/src/mongo/db/session_catalog.cpp
@@ -237,7 +237,8 @@ void SessionCatalog::_releaseSession(const LogicalSessionId& lsid) {
OperationContextSession::OperationContextSession(OperationContext* opCtx,
bool checkOutSession,
- boost::optional<bool> autocommit)
+ boost::optional<bool> autocommit,
+ boost::optional<bool> startTransaction)
: _opCtx(opCtx) {
if (!opCtx->getLogicalSessionId()) {
@@ -265,7 +266,8 @@ OperationContextSession::OperationContextSession(OperationContext* opCtx,
checkedOutSession->get()->refreshFromStorageIfNeeded(opCtx);
if (opCtx->getTxnNumber()) {
- checkedOutSession->get()->beginOrContinueTxn(opCtx, *opCtx->getTxnNumber(), autocommit);
+ checkedOutSession->get()->beginOrContinueTxn(
+ opCtx, *opCtx->getTxnNumber(), autocommit, startTransaction);
}
}