I'm trying to implement a file storage mechanism which holds a number of variably-sized records in a single file with the guarantee that the set of records will always be recoverable into a consistent state, even if the system failed at a hardware level.
So far, every scheme I've come up with pivots on writing data sequentially. Some piece of data would be appended to the end of each record which confirms that the write succeeded. However, if the data is not necessarily written to the disk sequentially when flushed then it would be possible for the confirmation data to be written before the content data.
There are two obvious ways around this, but both are undesirable:
I'm using C# on Windows (32 and 64-bit) and .Net 4.0's memory mapped file implementation
This is too low level and OS specific for C#. try using Windows APIs from C, and read very carefully the API specifiations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With