Persistent Storage Rules
This section describes the rules that must be upheld for persistent storage.
Pages
- Each page key should be managed exclusively by a single
IPersistentStorageSession
; cross-session usage is not allowed. - An
IPersistentStorageSession
must always be used in a single-threaded context; multi-threaded calls are not permitted. - Each page key should be written to persistent storage only once per checkpoint to minimize unnecessary network traffic.
- After a Commit operation, all page must be immediately available for read operations and return the written values, ensuring no eventual consistency delays.
- Data must be ensured to be persisted when
CheckpointAsync
returns, but the storage solution can return in-memory data before that to comply with rule 4. - If any page can not be written, an exception must be thrown. It is allowed to retry before throwing.
Recovery
- The system must always be able to restore to the exact state of the last checkpoint.
- Any pages written must be restored to their previous value when recovering to the previous checkpoint.
- Deleted pages must be restored with their previous value when recovering to the previous checkpoint.
- Recovery only needs to support the most recent successful checkpoint; there is no requirement to support rollbacks to earlier checkpoints.
Checkpointing
- Only one checkpoint will be active at a time. Only call the
Commit
method for data that must be peristed when theOnCheckpoint
method is invoked on an operator.