mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
mdb_env_sync(,force=1): Override MDB_MAPASYNC.
With MDB_MAPASYNC, the API provided no way to ensure full sync.
This commit is contained in:
parent
b9275c9991
commit
97ed96206d
@ -1523,7 +1523,8 @@ mdb_env_sync(MDB_env *env, int force)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) {
|
if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) {
|
||||||
if (env->me_flags & MDB_WRITEMAP) {
|
if (env->me_flags & MDB_WRITEMAP) {
|
||||||
int flags = (env->me_flags & MDB_MAPASYNC) ? MS_ASYNC : MS_SYNC;
|
int flags = ((env->me_flags & MDB_MAPASYNC) && !force)
|
||||||
|
? MS_ASYNC : MS_SYNC;
|
||||||
if (MDB_MSYNC(env->me_map, env->me_mapsize, flags))
|
if (MDB_MSYNC(env->me_map, env->me_mapsize, flags))
|
||||||
rc = ErrCode();
|
rc = ErrCode();
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -500,9 +500,9 @@ int mdb_env_info(MDB_env *env, MDB_envinfo *stat);
|
|||||||
* the OS buffers upon commit as well, unless the environment was
|
* the OS buffers upon commit as well, unless the environment was
|
||||||
* opened with #MDB_NOSYNC.
|
* opened with #MDB_NOSYNC.
|
||||||
* @param[in] env An environment handle returned by #mdb_env_create()
|
* @param[in] env An environment handle returned by #mdb_env_create()
|
||||||
* @param[in] force If non-zero, force the flush to occur. Otherwise
|
* @param[in] force If non-zero, force a synchronous flush. Otherwise
|
||||||
* if the environment has the #MDB_NOSYNC flag set the flushes
|
* if the environment has the #MDB_NOSYNC flag set the flushes
|
||||||
* will be omitted.
|
* will be omitted, and with #MDB_MAPASYNC they will be asynchronous.
|
||||||
* @return A non-zero error value on failure and 0 on success. Some possible
|
* @return A non-zero error value on failure and 0 on success. Some possible
|
||||||
* errors are:
|
* errors are:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
Loading…
Reference in New Issue
Block a user