summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/storage_engine.h
diff options
context:
space:
mode:
authorJudah Schvimer <judah@mongodb.com>2017-07-11 10:48:04 -0400
committerJudah Schvimer <judah@mongodb.com>2017-07-11 10:48:04 -0400
commit2ed5ff7d34959ebe204697ff615d24a8eabc45bf (patch)
treec0fe1b23ba80ee05cdb1694faaad1bf0a6945048 /src/mongo/db/storage/storage_engine.h
parentf33e9a715cf3eb4d29d8d5c5a926e5edacf9f63d (diff)
downloadmongo-2ed5ff7d34959ebe204697ff615d24a8eabc45bf.tar.gz
SERVER-29889 Creates skeleton for recovery to timestamp storage engine API changes
Diffstat (limited to 'src/mongo/db/storage/storage_engine.h')
-rw-r--r--src/mongo/db/storage/storage_engine.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mongo/db/storage/storage_engine.h b/src/mongo/db/storage/storage_engine.h
index f3f00631c8d..64428fdfd43 100644
--- a/src/mongo/db/storage/storage_engine.h
+++ b/src/mongo/db/storage/storage_engine.h
@@ -35,6 +35,7 @@
#include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h"
+#include "mongo/db/storage/snapshot_name.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -280,6 +281,43 @@ public:
*/
virtual void setJournalListener(JournalListener* jl) = 0;
+ /**
+ * Returns whether the storage engine supports "recover to stable timestamp". Returns false
+ * if the storage engine supports the "recover to stable timestamp" feature but does not have
+ * a stable timestamp, or if for some reason the storage engine is unable to recover to the
+ * last provided stable timestamp.
+ */
+ virtual bool supportsRecoverToStableTimestamp() const {
+ return false;
+ }
+
+ /**
+ * Recovers the storage engine state to the last stable timestamp. "Stable" in this case
+ * refers to a timestamp that is guaranteed to never be rolled back. The stable timestamp
+ * used should be one provided by StorageEngine::setStableTimestamp().
+ *
+ * The "local" database is exempt and should not roll back any state except for
+ * "local.replset.minvalid" and "local.replset.checkpointTimestamp" which must roll back to
+ * the last stable timestamp.
+ *
+ * fasserts if StorageEngine::supportsRecoverToStableTimestamp() would return false.
+ */
+ virtual Status recoverToStableTimestamp() {
+ fassertFailed(40547);
+ }
+
+ /**
+ * Sets the highest timestamp at which the storage engine is allowed to take a checkpoint.
+ * This timestamp can never decrease, and thus should be a timestamp that can never roll back.
+ */
+ virtual void setStableTimestamp(SnapshotName snapshotName) {}
+
+ /**
+ * Tells the storage engine the timestamp of the data at startup. This is necessary because
+ * timestamps are not persisted in the storage layer.
+ */
+ virtual void setInitialDataTimestamp(SnapshotName snapshotName) {}
+
protected:
/**
* The destructor will never be called. See cleanShutdown instead.