From 0fc2d39cceb9ae3d4d2d3ef2a630e85789a1fdf6 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sat, 20 Jun 2020 23:55:15 +0300 Subject: [PATCH] mdbx: allow mixind with/without MDBX_WRITEMAP for the same database. Change-Id: I916bb9e9b44a58cf78786e76a8c42d62e0bfc579 --- mdbx.h | 14 +++++--------- src/core.c | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/mdbx.h b/mdbx.h index 9ade5500..1d904c0d 100644 --- a/mdbx.h +++ b/mdbx.h @@ -999,9 +999,6 @@ LIBMDBX_API const char *mdbx_dump_val(const MDBX_val *key, char *const buf, * database pages and more work for tracking ones, which neuters a * performance boost caused by the MDBX_WRITEMAP mode. * - * NOTE: MDBX don't allow to mix processes with and without MDBX_WRITEMAP on - * the same environment. In such case MDBX_INCOMPATIBLE will be generated. - * * - with MDBX_WRITEMAP = all data will be mapped into memory in the read-write * mode. This offers a significant performance benefit, since the data will * be modified directly in mapped memory and then flushed to disk by @@ -1611,9 +1608,9 @@ LIBMDBX_API int mdbx_env_create(MDBX_env **penv); * NOTE: MDB_NOLOCK flag don't supported by MDBX, * try use MDBX_EXCLUSIVE as a replacement. * - * NOTE: MDBX don't allow to mix processes with different MDBX_WRITEMAP, - * MDBX_SAFE_NOSYNC, MDBX_NOMETASYNC, MDBX_MAPASYNC flags on the same - * environment. In such case MDBX_INCOMPATIBLE will be returned. + * NOTE: MDBX don't allow to mix processes with different MDBX_SAFE_NOSYNC, + * MDBX_NOMETASYNC, MDBX_MAPASYNC flags on the same environment. + * In such case MDBX_INCOMPATIBLE will be returned. * * If the database is already exist and parameters specified early by * mdbx_env_set_geometry() are incompatible (i.e. for instance, different page @@ -1637,9 +1634,8 @@ LIBMDBX_API int mdbx_env_create(MDBX_env **penv); * or the current process tries to open environment * more than once. * - MDBX_INCOMPATIBLE = Environment is already opened by another process, - * but with different set of MDBX_WRITEMAP, - * MDBX_SAFE_NOSYNC, MDBX_NOMETASYNC, MDBX_MAPASYNC - * flags. + * but with different set of MDBX_SAFE_NOSYNC, + * MDBX_NOMETASYNC, MDBX_MAPASYNC flags. * Or if the database is already exist and * parameters specified early by * mdbx_env_set_geometry() are incompatible (i.e. diff --git a/src/core.c b/src/core.c index 94f18b2f..cc2196d5 100644 --- a/src/core.c +++ b/src/core.c @@ -10189,8 +10189,7 @@ int __cold mdbx_env_open(MDBX_env *env, const char *pathname, unsigned flags, goto bailout; } - const unsigned rigorous_flags = - MDBX_WRITEMAP | MDBX_SAFE_NOSYNC | MDBX_MAPASYNC; + const unsigned rigorous_flags = MDBX_SAFE_NOSYNC | MDBX_MAPASYNC; const unsigned mode_flags = rigorous_flags | MDBX_NOMETASYNC | MDBX_LIFORECLAIM | MDBX_COALESCE | MDBX_NORDAHEAD;