-
Notifications
You must be signed in to change notification settings - Fork 6
Data Consistency
Jude Pereira edited this page Jul 16, 2020
·
7 revisions
Required reading: Blocks
Since StormDB addresses key-value pairs using an offset based strategy, the file contents must be perfectly aligned. If this is not the case (for example, partial writes, force kill) the entire database would be irrecoverable.
To ensure that data is readable even in the face of all odds, StormDB implements two strategies:
- A CRC32 checksum added at the end of each block
- Appends a dummy key-value pair (aka sync marker) before the start of every block
The following frame applies for both, the WAL and the data file:
+---------------------|--------------|----------+
| sync marker kv pair | 128 kv pairs | checksum |
+---------------------|--------------|----------+