mirror of
https://github.com/isar/libmdbx.git
synced 2025-09-06 13:42:21 +08:00
mdbx: fix inappropriate/irrelevant MDBX_WANNA_RECOVERY
when the DB size is not rounded to sys-allocation-granularity (imported from the stable
branch).
For now this is just the patch that eliminates regression by making the least risky/invasive changes. However a complete fix involves refining the rounding of a database size, which still is to do. The check corrected by this commit was never fundamentally important, but it was added to verify the logic of rounding the database size in various cases. However, after the commit `2a7f460345edbeb26a51782cbe6af3c55254ae77` (using `fallocate()` to prevent `SIGBUS`), the behavior change led to the returning error `MDBX_WANNA_RECOVERY` in fairly harmless conditions.
This commit is contained in:
@@ -661,9 +661,8 @@ __cold int dxb_setup(MDBX_env *env, const int lck_rc, const mdbx_mode_t mode_bit
|
||||
}
|
||||
|
||||
if (env->flags & MDBX_RDONLY) {
|
||||
if (filesize_before & (globals.sys_allocation_granularity - 1)) {
|
||||
ERROR("filesize should be rounded-up to system allocation granularity %u",
|
||||
globals.sys_allocation_granularity);
|
||||
if (filesize_before & (globals.sys_pagesize - 1)) {
|
||||
ERROR("filesize should be rounded-up to system page size %u", globals.sys_pagesize);
|
||||
return MDBX_WANNA_RECOVERY;
|
||||
}
|
||||
WARNING("%s", "ignore filesize mismatch in readonly-mode");
|
||||
|
Reference in New Issue
Block a user