diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2020-03-20 09:04:22 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-03-20 15:24:52 +0000 |
commit | 5ab625013bcf6438515dceb5fe7c2228257cb863 (patch) | |
tree | e319b2b5907db52ad1685317ebdca14d3c0fa7e5 /src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | |
parent | 9846834c3ad936367657e11f03f283af4b305717 (diff) | |
download | mongo-5ab625013bcf6438515dceb5fe7c2228257cb863.tar.gz |
SERVER-45147: Ensure ghost timestamped transactions trigger the stable timestamp to advance when they commit/abort. Ensure the durable timestamp does not move backwards.
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp')
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index 26ef526ae86..00a0a7b3da8 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -1825,6 +1825,8 @@ void WiredTigerKVEngine::setStableTimestamp(Timestamp stableTimestamp, bool forc stableTSConfigString = "force=true,oldest_timestamp={0:x},commit_timestamp={0:x},stable_timestamp={0:x}"_format( ts); + stdx::lock_guard<Latch> lk(_highestDurableTimestampMutex); + _highestSeenDurableTimestamp = ts; } else { stableTSConfigString = "stable_timestamp={:x}"_format(ts); } @@ -1881,6 +1883,8 @@ void WiredTigerKVEngine::setOldestTimestamp(Timestamp newOldestTimestamp, bool f newOldestTimestamp.asULL()); invariantWTOK(_conn->set_timestamp(_conn, oldestTSConfigString.c_str())); _oldestTimestamp.store(newOldestTimestamp.asULL()); + stdx::lock_guard<Latch> lk(_highestDurableTimestampMutex); + _highestSeenDurableTimestamp = newOldestTimestamp.asULL(); LOGV2_DEBUG(22342, 2, "oldest_timestamp and commit_timestamp force set to {newOldestTimestamp}", @@ -2009,7 +2013,15 @@ StatusWith<Timestamp> WiredTigerKVEngine::recoverToStableTimestamp(OperationCont } Timestamp WiredTigerKVEngine::getAllDurableTimestamp() const { - return Timestamp(_oplogManager->fetchAllDurableValue(_conn)); + auto ret = _oplogManager->fetchAllDurableValue(_conn); + + stdx::lock_guard<Latch> lk(_highestDurableTimestampMutex); + if (ret < _highestSeenDurableTimestamp) { + ret = _highestSeenDurableTimestamp; + } else { + _highestSeenDurableTimestamp = ret; + } + return Timestamp(ret); } Timestamp WiredTigerKVEngine::getOldestOpenReadTimestamp() const { |