summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2018-05-16 15:08:37 -0400
committerDianna Hohensee <dianna.hohensee@10gen.com>2018-05-17 11:16:36 -0400
commit04fc6cc223b1599131d912c7e3654001f561b07b (patch)
treed6963a2c823a4a6158f803727e40c2d090311063
parentbd105e30805b88477452127c726ae2156296efd1 (diff)
downloadmongo-04fc6cc223b1599131d912c7e3654001f561b07b.tar.gz
SERVER-34556 Iterating through indexes for a last applied timestamp transaction should use that timestamp
-rw-r--r--src/mongo/db/storage/recovery_unit.h2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/db/storage/recovery_unit.h b/src/mongo/db/storage/recovery_unit.h
index 66da0523094..a69d08be2ce 100644
--- a/src/mongo/db/storage/recovery_unit.h
+++ b/src/mongo/db/storage/recovery_unit.h
@@ -149,6 +149,8 @@ public:
* - when using ReadSource::kProvided, the timestamp provided.
* - when using ReadSource::kLastAppliedSnapshot, the timestamp chosen using the storage
* engine's last applied timestamp.
+ * - when using ReadSource::kLastApplied, the last applied timestamp at which the current
+ * storage transaction was opened, if one is open.
* - when using ReadSource::kMajorityCommitted, the majority committed timestamp chosen by the
* storage engine after a transaction has been opened or after a call to
* obtainMajorityCommittedSnapshot().
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
index 4b8620b8524..df20c04eb92 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_recovery_unit.cpp
@@ -320,6 +320,10 @@ boost::optional<Timestamp> WiredTigerRecoveryUnit::getPointInTimeReadTimestamp()
return _readAtTimestamp;
}
+ if (_timestampReadSource == ReadSource::kLastApplied && !_readAtTimestamp.isNull()) {
+ return _readAtTimestamp;
+ }
+
if (_timestampReadSource == ReadSource::kMajorityCommitted) {
invariant(!_majorityCommittedSnapshot.isNull());
return _majorityCommittedSnapshot;
@@ -359,8 +363,8 @@ void WiredTigerRecoveryUnit::_txnOpen() {
}
case ReadSource::kLastApplied: {
if (_sessionCache->snapshotManager().getLocalSnapshot()) {
- _sessionCache->snapshotManager().beginTransactionOnLocalSnapshot(session,
- _ignorePrepared);
+ _readAtTimestamp = _sessionCache->snapshotManager().beginTransactionOnLocalSnapshot(
+ session, _ignorePrepared);
} else {
WiredTigerBeginTxnBlock(session, _ignorePrepared).done();
}