mdbx: объявление опции `MDBX_COALESCE` устаревшей.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-04-04 11:59:39 +03:00
parent ae5d541efb
commit b9fd42b9b3
6 changed files with 13 additions and 12 deletions

View File

@ -94,8 +94,8 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "mdbx_env_create: (%d) %s\n", rc, mdbx_strerror(rc)); fprintf(stderr, "mdbx_env_create: (%d) %s\n", rc, mdbx_strerror(rc));
goto bailout; goto bailout;
} }
rc = mdbx_env_open(env, "./example-db", rc = mdbx_env_open(env, "./example-db", MDBX_NOSUBDIR | MDBX_LIFORECLAIM,
MDBX_NOSUBDIR | MDBX_COALESCE | MDBX_LIFORECLAIM, 0664); 0664);
if (rc != MDBX_SUCCESS) { if (rc != MDBX_SUCCESS) {
fprintf(stderr, "mdbx_env_open: (%d) %s\n", rc, mdbx_strerror(rc)); fprintf(stderr, "mdbx_env_open: (%d) %s\n", rc, mdbx_strerror(rc));
goto bailout; goto bailout;

6
mdbx.h
View File

@ -1327,8 +1327,9 @@ enum MDBX_env_flags_t {
* This flag may be changed at any time using `mdbx_env_set_flags()`. */ * This flag may be changed at any time using `mdbx_env_set_flags()`. */
MDBX_NOMEMINIT = UINT32_C(0x1000000), MDBX_NOMEMINIT = UINT32_C(0x1000000),
#ifndef _MSC_VER /* avoid madness MSVC */
/** Aims to coalesce a Garbage Collection items. /** Aims to coalesce a Garbage Collection items.
* \note Always enabled since v0.12 * \deprecated Always enabled since v0.12 and deprecated since v0.13.
* *
* With `MDBX_COALESCE` flag MDBX will aims to coalesce items while recycling * With `MDBX_COALESCE` flag MDBX will aims to coalesce items while recycling
* a Garbage Collection. Technically, when possible short lists of pages * a Garbage Collection. Technically, when possible short lists of pages
@ -1338,7 +1339,8 @@ enum MDBX_env_flags_t {
* Unallocated space and reducing the database file. * Unallocated space and reducing the database file.
* *
* This flag may be changed at any time using mdbx_env_set_flags(). */ * This flag may be changed at any time using mdbx_env_set_flags(). */
MDBX_COALESCE = UINT32_C(0x2000000), MDBX_COALESCE MDBX_DEPRECATED = UINT32_C(0x2000000),
#endif /* avoid madness MSVC */
/** LIFO policy for recycling a Garbage Collection items. /** LIFO policy for recycling a Garbage Collection items.
* *

View File

@ -1784,8 +1784,8 @@ log2n_powerof2(size_t value_uintptr) {
* environment and re-opening it with the new flags. */ * environment and re-opening it with the new flags. */
#define ENV_CHANGEABLE_FLAGS \ #define ENV_CHANGEABLE_FLAGS \
(MDBX_SAFE_NOSYNC | MDBX_NOMETASYNC | MDBX_DEPRECATED_MAPASYNC | \ (MDBX_SAFE_NOSYNC | MDBX_NOMETASYNC | MDBX_DEPRECATED_MAPASYNC | \
MDBX_NOMEMINIT | MDBX_COALESCE | MDBX_PAGEPERTURB | MDBX_ACCEDE | \ MDBX_NOMEMINIT | MDBX_DEPRECATED_COALESCE | MDBX_PAGEPERTURB | \
MDBX_VALIDATION) MDBX_ACCEDE | MDBX_VALIDATION)
#define ENV_CHANGELESS_FLAGS \ #define ENV_CHANGELESS_FLAGS \
(MDBX_NOSUBDIR | MDBX_RDONLY | MDBX_WRITEMAP | MDBX_NOSTICKYTHREADS | \ (MDBX_NOSUBDIR | MDBX_RDONLY | MDBX_WRITEMAP | MDBX_NOSTICKYTHREADS | \
MDBX_NORDAHEAD | MDBX_LIFORECLAIM | MDBX_EXCLUSIVE) MDBX_NORDAHEAD | MDBX_LIFORECLAIM | MDBX_EXCLUSIVE)

View File

@ -1227,7 +1227,7 @@ env::operate_parameters::make_flags(bool accede, bool use_subdirectory) const {
if (options.nested_write_transactions) if (options.nested_write_transactions)
flags &= ~MDBX_WRITEMAP; flags &= ~MDBX_WRITEMAP;
if (reclaiming.coalesce) if (reclaiming.coalesce)
flags |= MDBX_COALESCE; flags |= MDBX_env_flags_t(MDBX_DEPRECATED_COALESCE);
if (reclaiming.lifo) if (reclaiming.lifo)
flags |= MDBX_LIFORECLAIM; flags |= MDBX_LIFORECLAIM;
switch (durability) { switch (durability) {
@ -1272,7 +1272,7 @@ env::durability env::operate_parameters::durability_from_flags(
env::reclaiming_options::reclaiming_options(MDBX_env_flags_t flags) noexcept env::reclaiming_options::reclaiming_options(MDBX_env_flags_t flags) noexcept
: lifo((flags & MDBX_LIFORECLAIM) ? true : false), : lifo((flags & MDBX_LIFORECLAIM) ? true : false),
coalesce((flags & MDBX_COALESCE) ? true : false) {} coalesce((flags & MDBX_DEPRECATED_COALESCE) ? true : false) {}
env::operate_options::operate_options(MDBX_env_flags_t flags) noexcept env::operate_options::operate_options(MDBX_env_flags_t flags) noexcept
: no_sticky_threads(((flags & (MDBX_NOSTICKYTHREADS | MDBX_EXCLUSIVE)) == : no_sticky_threads(((flags & (MDBX_NOSTICKYTHREADS | MDBX_EXCLUSIVE)) ==

View File

@ -37,8 +37,8 @@ int main() {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
rc = mdbx_env_open(env, "./example-db", rc = mdbx_env_open(env, "./example-db", MDBX_NOSUBDIR | MDBX_LIFORECLAIM,
MDBX_NOSUBDIR | MDBX_COALESCE | MDBX_LIFORECLAIM, 0664); 0664);
if (rc != MDBX_SUCCESS) { if (rc != MDBX_SUCCESS) {
fprintf(stderr, "mdbx_env_open: (%d) %s\n", rc, mdbx_strerror(rc)); fprintf(stderr, "mdbx_env_open: (%d) %s\n", rc, mdbx_strerror(rc));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);

View File

@ -62,8 +62,7 @@ int main(int argc, const char *argv[]) {
errmsg = "failed to mdbx_env_create: %s\n"; errmsg = "failed to mdbx_env_create: %s\n";
goto Fail; goto Fail;
} }
if ((rc = mdbx_env_open( if ((rc = mdbx_env_open(env, ".", MDBX_NOSUBDIR | MDBX_LIFORECLAIM, 0644))) {
env, ".", MDBX_NOSUBDIR | MDBX_COALESCE | MDBX_LIFORECLAIM, 0644))) {
errmsg = "failed to mdbx_env_open: %s\n"; errmsg = "failed to mdbx_env_open: %s\n";
goto Fail; goto Fail;
} }