diff options
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r-- | src/mongo/db/storage/storage_options.h | 3 | ||||
-rw-r--r-- | src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/storage/storage_options.h b/src/mongo/db/storage/storage_options.h index 733808ce3c1..ceec92d42fb 100644 --- a/src/mongo/db/storage/storage_options.h +++ b/src/mongo/db/storage/storage_options.h @@ -109,6 +109,9 @@ struct StorageGlobalParams { // an existing underlying MongoDB database level resource if possible. This can improve // workloads that rely heavily on creating many collections within a database. bool groupCollections; + + // Controls whether we allow the OplogStones mechanism to delete oplog history on WT. + bool allowOplogTruncation = true; }; extern StorageGlobalParams storageGlobalParams; diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp index b978edec751..d9d07d00cd1 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp @@ -1854,6 +1854,11 @@ boost::optional<Timestamp> WiredTigerKVEngine::getOplogNeededForCrashRecovery() Timestamp WiredTigerKVEngine::getPinnedOplog() const { stdx::lock_guard<stdx::mutex> lock(_oplogPinnedByBackupMutex); + if (!storageGlobalParams.allowOplogTruncation) { + // If oplog truncation is not allowed, then return the min timestamp so that no history is + // ever allowed to be deleted. + return Timestamp::min(); + } if (_oplogPinnedByBackup) { // All the oplog since `_oplogPinnedByBackup` should remain intact during the backup. return _oplogPinnedByBackup.get(); |