mdbx: disable non-blocking DB-close under Windows.

Change-Id: If6579467132439b6b627e756f67f6bd35fed8b4f
This commit is contained in:
Leo Yuriev 2018-06-13 02:43:44 +03:00
parent 634efbe34b
commit efdcbd8c35

View File

@ -5945,8 +5945,19 @@ int __cold mdbx_env_close_ex(MDBX_env *env, int dont_sync) {
env->me_txn0->mt_owner != mdbx_thread_self()) env->me_txn0->mt_owner != mdbx_thread_self())
return MDBX_BUSY; return MDBX_BUSY;
if (!dont_sync) { if (!dont_sync) {
#if defined(_WIN32) || defined(_WIN64)
/* On windows, without blocking is impossible to determine whether another
* process is running a writing transaction or not.
* Because in the "owner died" condition kernel don't release
* file lock immediately. */
rc = mdbx_env_sync_ex(env, true, false);
#else
rc = mdbx_env_sync_ex(env, true, true); rc = mdbx_env_sync_ex(env, true, true);
rc = (rc == MDBX_BUSY) ? MDBX_SUCCESS : rc; rc = (rc == MDBX_BUSY || rc == EAGAIN || rc == EACCES || rc == EBUSY ||
rc == EWOULDBLOCK)
? MDBX_SUCCESS
: rc;
#endif
} }
} }