summaryrefslogtreecommitdiff
path: root/src/mongo/db/read_concern_mongod.cpp
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2018-10-22 21:57:16 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2018-11-08 18:11:44 -0500
commit4fb38d9c10123321dada6fe1be477f9cb99732a7 (patch)
tree0a84c02c5445e3ce996bf3e4efefbcfaf64b7a07 /src/mongo/db/read_concern_mongod.cpp
parenta955b238b22c81c3cc4ec840aaf8e25d280ac9c8 (diff)
downloadmongo-4fb38d9c10123321dada6fe1be477f9cb99732a7.tar.gz
SERVER-37179 Pull out starting transaction from session checkout and push it down to before command execution.
Transaction will begin or continue after waiting for read concern. If an error is thrown on starting transaction, it'll be able to wait for write concern if a write concern is specified.
Diffstat (limited to 'src/mongo/db/read_concern_mongod.cpp')
-rw-r--r--src/mongo/db/read_concern_mongod.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/mongo/db/read_concern_mongod.cpp b/src/mongo/db/read_concern_mongod.cpp
index fc4e437a6a7..c50d296601f 100644
--- a/src/mongo/db/read_concern_mongod.cpp
+++ b/src/mongo/db/read_concern_mongod.cpp
@@ -203,9 +203,8 @@ MONGO_REGISTER_SHIM(waitForReadConcern)
// illegal to wait for read concern. This is fine, since the outer operation should have handled
// waiting for read concern. We don't want to ignore prepare conflicts because snapshot reads
// should block on prepared transactions.
- auto txnParticipant = TransactionParticipant::get(opCtx);
- if (opCtx->getClient()->isInDirectClient() && txnParticipant &&
- txnParticipant->inMultiDocumentTransaction()) {
+ if (opCtx->getClient()->isInDirectClient() &&
+ readConcernArgs.getLevel() == repl::ReadConcernLevel::kSnapshotReadConcern) {
opCtx->recoveryUnit()->setIgnorePrepared(false);
return Status::OK();
}
@@ -293,13 +292,6 @@ MONGO_REGISTER_SHIM(waitForReadConcern)
return {ErrorCodes::NotAReplicaSet,
"node needs to be a replica set member to use readConcern: snapshot"};
}
- if (speculative) {
- txnParticipant->setSpeculativeTransactionOpTime(
- opCtx,
- readConcernArgs.getOriginalLevel() == repl::ReadConcernLevel::kSnapshotReadConcern
- ? SpeculativeTransactionOpTime::kAllCommitted
- : SpeculativeTransactionOpTime::kLastApplied);
- }
}
if (atClusterTime) {