IO Handling

Some notes about handling IO operations, file access etc in MapDB.

File Rename & replace

This operation replaces content of one file with another file. Original file (if existed )is usually destroyed. File Rename is very fast on local filesystems.

MapDB renames and replaces files in a few places; for example store compaction recreates store content in new file and than replaces original file.

Challenges

File Replace algorithm

This is sequence for replacing files, to ensure it recovers from crash

File Open algorithm

This sequence should be used when file is opened, to ensure that DB recovers if system crashed in middle of file rename

Here is decision matrix, validation uses checksum or whatever, if validation is not possible just always assume valid file: