mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-20 05:08:21 +08:00
mdbx: explicit sync lck-file after re-write/re-create.
Change-Id: I2fad76b1d04e4b0cd2ca08cb722bd819153f9824
This commit is contained in:
parent
7f920b5cfc
commit
1f301e7e6f
10
src/core.c
10
src/core.c
@ -9801,6 +9801,16 @@ static int __cold mdbx_setup_lck(MDBX_env *env, char *lck_pathname,
|
|||||||
mdbx_jitter4testing(false);
|
mdbx_jitter4testing(false);
|
||||||
lck->mti_magic_and_version = MDBX_LOCK_MAGIC;
|
lck->mti_magic_and_version = MDBX_LOCK_MAGIC;
|
||||||
lck->mti_os_and_format = MDBX_LOCK_FORMAT;
|
lck->mti_os_and_format = MDBX_LOCK_FORMAT;
|
||||||
|
err = mdbx_msync(&env->me_lck_mmap, 0, (size_t)size, false);
|
||||||
|
if (unlikely(err != MDBX_SUCCESS)) {
|
||||||
|
mdbx_error("initial-%s for lck-file failed", "msync");
|
||||||
|
goto bailout;
|
||||||
|
}
|
||||||
|
err = mdbx_filesync(env->me_lck_mmap.fd, MDBX_SYNC_SIZE);
|
||||||
|
if (unlikely(err != MDBX_SUCCESS)) {
|
||||||
|
mdbx_error("initial-%s for lck-file failed", "fsync");
|
||||||
|
goto bailout;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (lck->mti_magic_and_version != MDBX_LOCK_MAGIC) {
|
if (lck->mti_magic_and_version != MDBX_LOCK_MAGIC) {
|
||||||
mdbx_error("%s", "lock region has invalid magic/version");
|
mdbx_error("%s", "lock region has invalid magic/version");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user