mdbx: add MDBX_PNL_ASCENDING build option and dependency for MDBX_DATA_MAGIC.

Change-Id: I55283240b1dbbbc093927be5eaa5d42b87294f72
This commit is contained in:
Leonid Yuriev 2021-01-20 13:05:32 +03:00
parent 6bd0277020
commit 730b9ea3fd
2 changed files with 17 additions and 7 deletions

View File

@ -590,7 +590,8 @@ typedef struct MDBX_lockinfo {
(unsigned)offsetof(MDBX_lockinfo, mti_numreaders) * 37 + \
(unsigned)offsetof(MDBX_lockinfo, mti_readers) * 29)
#define MDBX_DATA_MAGIC ((MDBX_MAGIC << 8) + MDBX_DATA_VERSION)
#define MDBX_DATA_MAGIC \
((MDBX_MAGIC << 8) + MDBX_PNL_ASCENDING * 64 + MDBX_DATA_VERSION)
#define MDBX_DATA_MAGIC_DEVEL ((MDBX_MAGIC << 8) + 255)
#define MDBX_LOCK_MAGIC ((MDBX_MAGIC << 8) + MDBX_LOCK_VERSION)
@ -636,13 +637,12 @@ typedef struct MDBX_lockinfo {
#endif /* MDBX_WORDBITS */
/*----------------------------------------------------------------------------*/
/* Two kind lists of pages (aka PNL) */
/* An PNL is an Page Number List, a sorted array of IDs. The first element of
* the array is a counter for how many actual page-numbers are in the list.
* PNLs are sorted in descending order, this allow cut off a page with lowest
* pgno (at the tail) just truncating the list */
#define MDBX_PNL_ASCENDING 0
/* An PNL is an Page Number List, a sorted array of IDs.
* The first element of the array is a counter for how many actual page-numbers
* are in the list. By default PNLs are sorted in descending order, this allow
* cut off a page with lowest pgno (at the tail) just truncating the list. The
* sort order of PNLs is controlled by the MDBX_PNL_ASCENDING build option. */
typedef pgno_t *MDBX_PNL;
#if MDBX_PNL_ASCENDING

View File

@ -98,6 +98,16 @@
#error MDBX_ENABLE_REFUND must be defined as 0 or 1
#endif /* MDBX_ENABLE_REFUND */
/** Controls sort order of internal page number lists.
* The database format depend on this option and libmdbx builded with different
* option value are incompatible. */
#ifndef MDBX_PNL_ASCENDING
#define MDBX_PNL_ASCENDING 0
#endif
#if !(MDBX_PNL_ASCENDING == 0 || MDBX_PNL_ASCENDING == 1)
#error MDBX_PNL_ASCENDING must be defined as 0 or 1
#endif /* MDBX_PNL_ASCENDING */
//------------------------------------------------------------------------------
/** Win32 File Locking API for \ref MDBX_LOCKING */