mdbx: minor refine MDBX_MMAP_INCOHERENT_FILE_WRITE.

Change-Id: I1e77eccc64b470bf3c7aeb8f6b905b72e818f7a0
This commit is contained in:
Leonid Yuriev 2019-12-24 20:12:55 +03:00
parent bdb4ccb352
commit 379a789839

View File

@ -8997,21 +8997,21 @@ int __cold mdbx_env_open(MDBX_env *env, const char *pathname, unsigned flags,
~(MDBX_WRITEMAP | MDBX_MAPASYNC | MDBX_SAFE_NOSYNC | MDBX_NOMETASYNC |
MDBX_COALESCE | MDBX_LIFORECLAIM | MDBX_NOMEMINIT | MDBX_ACCEDE);
} else {
#ifdef __OpenBSD__
/* Temporary `workaround` for OpenBSD kernel's bug.
#if MDBX_MMAP_INCOHERENT_FILE_WRITE
/* Temporary `workaround` for OpenBSD kernel's flaw.
* See https://github.com/leo-yuriev/libmdbx/issues/67 */
if ((flags & MDBX_WRITEMAP) == 0) {
if (flags & MDBX_ACCEDE)
flags |= MDBX_WRITEMAP;
else {
mdbx_debug_log(MDBX_LOG_ERROR, __func__, __LINE__,
"OpenBSD requires MDBX_WRITEMAP because of an internal "
"bug(s) in a file/buffer/page cache.\n");
"System (i.e. OpenBSD) requires MDBX_WRITEMAP because "
"of an internal flaw(s) in a file/buffer/page cache.\n");
rc = 42 /* ENOPROTOOPT */;
goto bailout;
}
}
#endif /* __OpenBSD__ */
#endif /* MDBX_MMAP_INCOHERENT_FILE_WRITE */
env->me_dirtylist = mdbx_calloc(MDBX_DPL_TXNFULL + 1, sizeof(MDBX_DP));
if (!env->me_dirtylist)
rc = MDBX_ENOMEM;