diff --git a/src/core.c b/src/core.c index 4d82daa2..785d81ec 100644 --- a/src/core.c +++ b/src/core.c @@ -5109,9 +5109,6 @@ static int mdbx_txn_spill(MDBX_txn *txn, MDBX_cursor *m0, unsigned need) { int rc = MDBX_SUCCESS; if (txn->mt_flags & MDBX_WRITEMAP) { MDBX_dpl *const dl = txn->tw.dirtylist; -#ifndef MDBX_FAKE_SPILL_WRITEMAP -#define MDBX_FAKE_SPILL_WRITEMAP 1 -#endif const unsigned span = dl->length - txn->tw.loose_count; txn->tw.dirtyroom += span; if (MDBX_FAKE_SPILL_WRITEMAP) { diff --git a/src/options.h b/src/options.h index 7799269d..8b641c22 100644 --- a/src/options.h +++ b/src/options.h @@ -131,6 +131,25 @@ #error MDBX_DPL_PREALLOC_FOR_RADIXSORT must be defined as 0 or 1 #endif /* MDBX_DPL_PREALLOC_FOR_RADIXSORT */ +/* Basically, this build-option is for TODO. Guess it should be replaced + * with MDBX_ENABLE_WRITEMAP_SPILLING with the three variants: + * 0/OFF = Don't track dirty pages at all and don't spilling ones. + * This should be by-default on Linux and may-be other systems + * (not sure: Darwin/OSX, FreeBSD, Windows 10) where kernel provides + * properly LRU tracking and async writing on-demand. + * 1/ON = Lite tracking of dirty pages but with LRU labels and explicit + * spilling with msync(MS_ASYNC). */ +#ifndef MDBX_FAKE_SPILL_WRITEMAP +#if defined(__linux__) || defined(__gnu_linux__) +#define MDBX_FAKE_SPILL_WRITEMAP 1 /* msync(MS_ASYNC) is no-op on Linux */ +#else +#define MDBX_FAKE_SPILL_WRITEMAP 0 +#endif +#endif +#if !(MDBX_FAKE_SPILL_WRITEMAP == 0 || MDBX_FAKE_SPILL_WRITEMAP == 1) +#error MDBX_FAKE_SPILL_WRITEMAP must be defined as 0 or 1 +#endif /* MDBX_FAKE_SPILL_WRITEMAP */ + /** Controls sort order of internal page number lists. * The database format depend on this option and libmdbx builded with different * option value are incompatible. */