Search code examples
javaconsistencymapdb

what is the cost of using `checksumHeaderBypass` in mapdb?


we are using mapdb to store a list of files that have been visited during a long running process, so that if we need to abort or if the process crashes we can resume where we left off.

we want to protect against crashes corrupting our mapdb file store.

so we are using transactions where we periodically commit changes to disk.

but then i noticed something interesting that if we crash our process in certain times we still get the error

Header checksum broken. Store was not closed correctly and might be corrupted. Use DBMaker.checksumHeaderBypass() to recover your data. Use clean shutdown or enable transactions to protect the store in the future.

But indeed setting the checksumHeaderBypass makes the error go away. What is the cost of using this checksumHeaderBypass setting?


Solution

  • If you use mapdb from @postcontruct in springboot app it throws this error. Avoid initialising mapdb before the app started (don't initialize from @postconstruct).