summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2022-10-27 13:35:40 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-10-27 18:45:07 +0000
commit5c4ba90caaa63e13ebaeed1cd523bdb56833ad8a (patch)
treeaa5fd6cbaf4c1cecc56b1ef62c35e7f8a2fac637
parentc32ea289b77a3ec19651a0beb49d62275928355c (diff)
downloadmongo-5c4ba90caaa63e13ebaeed1cd523bdb56833ad8a.tar.gz
SERVER-70838: Choose checkpoint_retention based on the sync delay.
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp23
1 files changed, 22 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 81433dd1c0c..f98b8c0993a 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -437,7 +437,28 @@ WiredTigerKVEngine::WiredTigerKVEngine(OperationContext* opCtx,
// If MongoDB startup fails, there may be clues from the previous run still left in the WT
// log files that can provide some insight into how the system got into a bad state. When
// testing is enabled, keep around some of these files for investigative purposes.
- ss << "debug_mode=(table_logging=true,checkpoint_retention=4),";
+ //
+ // We strive to keep 4 minutes of logs. Increase the retention for tests that take
+ // checkpoints more often.
+ const double fourMinutesInSeconds = 240.0;
+ int ckptsPerFourMinutes;
+ if (storageGlobalParams.checkpointDelaySecs <= 0.0) {
+ ckptsPerFourMinutes = 1;
+ } else {
+ ckptsPerFourMinutes =
+ static_cast<int>(fourMinutesInSeconds / storageGlobalParams.checkpointDelaySecs);
+ }
+
+ if (ckptsPerFourMinutes < 1) {
+ LOGV2_WARNING(8423377,
+ "Unexpected value for checkpoint retention",
+ "checkpointDelaySecs"_attr = storageGlobalParams.checkpointDelaySecs,
+ "ckptsPerFourMinutes"_attr = ckptsPerFourMinutes);
+ ckptsPerFourMinutes = 1;
+ }
+
+ ss << fmt::format("debug_mode=(table_logging=true,checkpoint_retention={}),",
+ ckptsPerFourMinutes);
}
if (gWiredTigerStressConfig) {
ss << "timing_stress_for_test=[history_store_checkpoint_delay,checkpoint_slow],";