diff options
Diffstat (limited to 'src/mongo/db/storage/recovery_unit.h')
| -rw-r--r-- | src/mongo/db/storage/recovery_unit.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/mongo/db/storage/recovery_unit.h b/src/mongo/db/storage/recovery_unit.h index eb032f73d4e..7b867906535 100644 --- a/src/mongo/db/storage/recovery_unit.h +++ b/src/mongo/db/storage/recovery_unit.h @@ -77,6 +77,22 @@ enum class PrepareConflictBehavior { }; /** + * DataCorruptionDetectionMode determines how we handle the discovery of evidence of data + * corruption. + */ +enum class DataCorruptionDetectionMode { + /** + * Always throw a DataCorruptionDetected error when evidence of data corruption is detected. + */ + kThrow, + /** + * When evidence of data corruption is decected, log an entry to the health log and the server + * logs, but do not throw an error. Continue attempting to return results. + */ + kLogAndContinue, +}; + +/** * A RecoveryUnit is responsible for ensuring that data is persisted. * All on-disk information must be mutated through this interface. */ @@ -711,6 +727,14 @@ public: return _noEvictionAfterRollback; } + void setDataCorruptionDetectionMode(DataCorruptionDetectionMode mode) { + _dataCorruptionDetectionMode = mode; + } + + DataCorruptionDetectionMode getDataCorruptionDetectionMode() const { + return _dataCorruptionDetectionMode; + } + /** * Returns true if this is an instance of RecoveryUnitNoop. */ @@ -718,6 +742,13 @@ public: return false; } + /** + * Sets a maximum timeout that the storage engine will block an operation when the cache is + * under pressure. + * If not set (default 0) then the storage engine will block indefinitely. + */ + virtual void setCacheMaxWaitTimeout(Milliseconds) {} + protected: RecoveryUnit(); @@ -770,6 +801,8 @@ protected: AbandonSnapshotMode _abandonSnapshotMode = AbandonSnapshotMode::kAbort; + DataCorruptionDetectionMode _dataCorruptionDetectionMode = DataCorruptionDetectionMode::kThrow; + private: // Sets the snapshot associated with this RecoveryUnit to a new globally unique id number. void assignNextSnapshotId(); |
