summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2019-03-28 14:02:42 -0400
committerDaniel Gottlieb <daniel.gottlieb@mongodb.com>2019-03-28 14:02:42 -0400
commit00afe420f0eccb4204c5a235049385a1189e9c78 (patch)
tree037ac347d4ad2219257d5fa12afa1cf42562281f /src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
parent62599f7cc9c1e7478eac80c5beedfc61e6f68408 (diff)
downloadmongo-00afe420f0eccb4204c5a235049385a1189e9c78.tar.gz
Revert "SERVER-39870: Guarantee the oldest timestamp obeys any initial data timestamp constraints."
This reverts commit ef38b62f0de257cfa0c5a2940c67949b7402079b.
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index b4196565db7..1655591d191 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1633,13 +1633,14 @@ void WiredTigerKVEngine::setOldestTimestampFromStable() {
return;
}
- const Timestamp initDataTs = getInitialDataTimestamp();
- if (!initDataTs.isNull() && newOldestTimestamp < initDataTs) {
- // The oldest timestamp is used to tell WT how much history to keep as well as to guard
- // readers from reading at too early of a timestamp. Readers may not read at a timestamp
- // prior to the initial data timestamp. Data is not guaranteed to be consistent at that
- // time.
- newOldestTimestamp = initDataTs;
+ const auto oplogReadTimestamp = Timestamp(_oplogManager->getOplogReadTimestamp());
+ if (!oplogReadTimestamp.isNull() && newOldestTimestamp > oplogReadTimestamp) {
+ // Oplog visibility is updated asynchronously from replication updating the commit point.
+ // When force is not set, lag the `oldest_timestamp` to the possibly stale oplog read
+ // timestamp value. This guarantees an oplog reader's `read_timestamp` can always
+ // be serviced. When force is set, we respect the caller's request and do not lag the
+ // oldest timestamp.
+ newOldestTimestamp = oplogReadTimestamp;
}
setOldestTimestamp(newOldestTimestamp, false);