mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 02:44:14 +08:00
mdbx: use mp_txnid
instead of P_DIRTY
(squashed).
Change-Id: I7e3174611b8819d8050b84d835fe976b87c77c0c
This commit is contained in:
parent
f587a74597
commit
958fd5b947
1008
src/core.c
1008
src/core.c
File diff suppressed because it is too large
Load Diff
@ -369,7 +369,12 @@ typedef struct MDBX_meta {
|
||||
* in the snapshot: Either used by a database or listed in a GC record. */
|
||||
typedef struct MDBX_page {
|
||||
union {
|
||||
uint64_t mp_txnid; /* txnid that committed this page */
|
||||
#define IS_FROZEN(txn, p) ((p)->mp_txnid < (txn)->mt_txnid)
|
||||
#define IS_SPILLED(txn, p) ((p)->mp_txnid == (txn)->mt_txnid)
|
||||
#define IS_SHADOWED(txn, p) ((p)->mp_txnid > (txn)->mt_txnid)
|
||||
#define IS_VALID(txn, p) ((p)->mp_txnid <= (txn)->mt_front)
|
||||
#define IS_MODIFIABLE(txn, p) ((p)->mp_txnid == (txn)->mt_front)
|
||||
uint64_t mp_txnid;
|
||||
struct MDBX_page *mp_next; /* for in-memory list of freed pages */
|
||||
};
|
||||
uint16_t mp_leaf2_ksize; /* key size if this is a LEAF2 page */
|
||||
@ -377,12 +382,13 @@ typedef struct MDBX_page {
|
||||
#define P_LEAF 0x02 /* leaf page */
|
||||
#define P_OVERFLOW 0x04 /* overflow page */
|
||||
#define P_META 0x08 /* meta page */
|
||||
#define P_DIRTY 0x10 /* dirty page, also set for P_SUBP pages */
|
||||
#define P_SPILLED 0x10 /* spilled in parent txn */
|
||||
#define P_LEAF2 0x20 /* for MDBX_DUPFIXED records */
|
||||
#define P_SUBP 0x40 /* for MDBX_DUPSORT sub-pages */
|
||||
#define P_BAD 0x80 /* explicit flag for invalid/bad page */
|
||||
#define P_LOOSE 0x4000 /* page was dirtied then freed, can be reused */
|
||||
#define P_KEEP 0x8000 /* leave this page alone during spill */
|
||||
#define P_ILL_BITS (~(P_BRANCH | P_LEAF | P_LEAF2 | P_OVERFLOW | P_SPILLED))
|
||||
uint16_t mp_flags;
|
||||
union {
|
||||
uint32_t mp_pages; /* number of overflow pages */
|
||||
@ -759,6 +765,8 @@ struct MDBX_txn {
|
||||
* Only committed write transactions increment the ID. If a transaction
|
||||
* aborts, the ID may be re-used by the next writer. */
|
||||
txnid_t mt_txnid;
|
||||
txnid_t mt_front;
|
||||
|
||||
MDBX_env *mt_env; /* the DB environment */
|
||||
/* Array of records for each DB known in the environment. */
|
||||
MDBX_dbx *mt_dbxs;
|
||||
@ -1271,8 +1279,6 @@ static __maybe_unused __inline void mdbx_jitter4testing(bool tiny) {
|
||||
#define IS_OVERFLOW(p) unlikely(((p)->mp_flags & P_OVERFLOW) != 0)
|
||||
/* Test if a page is a sub page */
|
||||
#define IS_SUBP(p) (((p)->mp_flags & P_SUBP) != 0)
|
||||
/* Test if a page is dirty */
|
||||
#define IS_DIRTY(p) (((p)->mp_flags & P_DIRTY) != 0)
|
||||
|
||||
#define PAGETYPE(p) ((p)->mp_flags & (P_BRANCH | P_LEAF | P_LEAF2 | P_OVERFLOW))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user