summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/storage_interface_impl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/storage_interface_impl.cpp')
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index 159179530a9..371a2c6af5f 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -74,6 +74,7 @@
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/rollback_gen.h"
#include "mongo/db/service_context.h"
+#include "mongo/db/storage/checkpointer.h"
#include "mongo/db/storage/control/journal_flusher.h"
#include "mongo/db/storage/control/storage_control.h"
#include "mongo/db/storage/durable_catalog.h"
@@ -1271,7 +1272,18 @@ void StorageInterfaceImpl::setStableTimestamp(ServiceContext* serviceCtx, Timest
"holdStableTimestamp"_attr = holdStableTimestamp);
}
});
- serviceCtx->getStorageEngine()->setStableTimestamp(newStableTimestamp);
+
+ StorageEngine* storageEngine = serviceCtx->getStorageEngine();
+ Timestamp prevStableTimestamp = storageEngine->getStableTimestamp();
+
+ storageEngine->setStableTimestamp(newStableTimestamp);
+
+ Checkpointer* checkpointer = Checkpointer::get(serviceCtx);
+ if (checkpointer && !checkpointer->hasTriggeredFirstStableCheckpoint()) {
+ checkpointer->triggerFirstStableCheckpoint(prevStableTimestamp,
+ storageEngine->getInitialDataTimestamp(),
+ storageEngine->getStableTimestamp());
+ }
}
void StorageInterfaceImpl::setInitialDataTimestamp(ServiceContext* serviceCtx,