我们使用mapdb来存储在长时间运行的进程中访问过的文件列表,这样如果我们需要中止或者进程崩溃,我们可以从中断的地方恢复。
我们希望防止崩溃破坏我们的mapdb 文件存储。
因此我们使用事务来定期将更改提交到磁盘。
但后来我注意到一些有趣的事情,如果我们在某些时候使进程崩溃,我们仍然会收到错误
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.
但确实设置 checksumHeaderBypass
会使错误消失。使用此 checksumHeaderBypass
设置的成本是多少?
最佳答案
如果您在 springboot 应用程序中使用 @postcontruct
中的 mapdb
,则会抛出此错误。避免在应用启动之前初始化 mapdb
(不要从 @postconstruct
初始化)。
关于java - 在mapdb中使用 `checksumHeaderBypass`的成本是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50723188/