FMDS protects data from corruption in multiple ways. During normal operation, data writes to an in-memory database, with no data files held open or writable. When it is time to flush the in-memory database, FMDS:
- Makes a copy of the warm file.
- Opens the original warm file in writable mode.
- Writes the new data to the warm file.
- Closes the warm file.
- Re-opens the warm file in read-only mode.
During each phase of this process, the SafeStore.dat file updates the current state to aid recovery if necessary. All writes to SafeStore.dat are done in such a way as to write-through the Windows file cache, guaranteeing that the state is always accurate.
Whenever the warm file reaches 150MB, it archives and renames itself. Archives are never opened in writable mode. Once a warm file is archived, it is safe. The warm file, itself is always safe, because a backup copy is made before any write operations to it are performed. The backup copy is left in place until the next flush.