summaryrefslogtreecommitdiff
path: root/src/mongo/db/read_concern.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2018-06-29 10:19:48 -0400
committerRandolph Tan <randolph@10gen.com>2018-08-08 16:00:20 -0400
commit52b2cc0886cdb992e2491067bdc029301d5bb6af (patch)
treec414da256a84890af3fb084ab699b572b49dab4f /src/mongo/db/read_concern.cpp
parent210bb5d91cb3c77bb3ed169114f8b85cd1062fb3 (diff)
downloadmongo-52b2cc0886cdb992e2491067bdc029301d5bb6af.tar.gz
SERVER-35900 Refactor transaction machinery out from Session class
Diffstat (limited to 'src/mongo/db/read_concern.cpp')
-rw-r--r--src/mongo/db/read_concern.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/read_concern.cpp b/src/mongo/db/read_concern.cpp
index f1130eb6942..cb8df144d25 100644
--- a/src/mongo/db/read_concern.cpp
+++ b/src/mongo/db/read_concern.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_parameters.h"
-#include "mongo/db/session_catalog.h"
+#include "mongo/db/transaction_participant.h"
#include "mongo/s/client/shard_registry.h"
#include "mongo/s/grid.h"
#include "mongo/util/log.h"
@@ -207,9 +207,9 @@ Status waitForReadConcern(OperationContext* opCtx,
// If we are in a direct client within a transaction, then we may be holding locks, so it is
// illegal to wait for read concern. This is fine, since the outer operation should have handled
// waiting for read concern.
- auto session = OperationContextSession::get(opCtx);
- if (opCtx->getClient()->isInDirectClient() && session &&
- session->inMultiDocumentTransaction()) {
+ auto txnParticipant = TransactionParticipant::get(opCtx);
+ if (opCtx->getClient()->isInDirectClient() && txnParticipant &&
+ txnParticipant->inMultiDocumentTransaction()) {
return Status::OK();
}
@@ -220,8 +220,8 @@ Status waitForReadConcern(OperationContext* opCtx,
// concern is not yet supported with atClusterTime.
//
// TODO SERVER-34620: Re-enable speculative behavior when "atClusterTime" is specified.
- const bool speculative =
- session && session->inMultiDocumentTransaction() && !readConcernArgs.getArgsAtClusterTime();
+ const bool speculative = txnParticipant && txnParticipant->inMultiDocumentTransaction() &&
+ !readConcernArgs.getArgsAtClusterTime();
if (readConcernArgs.getLevel() == repl::ReadConcernLevel::kLinearizableReadConcern) {
if (replCoord->getReplicationMode() != repl::ReplicationCoordinator::modeReplSet) {
@@ -295,7 +295,7 @@ Status waitForReadConcern(OperationContext* opCtx,
"node needs to be a replica set member to use readConcern: snapshot"};
}
if (speculative) {
- session->setSpeculativeTransactionOpTimeToLastApplied(opCtx);
+ txnParticipant->setSpeculativeTransactionOpTimeToLastApplied(opCtx);
}
}