mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 01:54:13 +08:00
mdbx: drop mx_dbistate
.
Change-Id: I61616ee1436ed99db93a1036c9bb7d4db7157c8f
This commit is contained in:
parent
5e334fa830
commit
f587a74597
11
src/core.c
11
src/core.c
@ -13829,7 +13829,7 @@ int mdbx_cursor_get(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data,
|
||||
}
|
||||
|
||||
static int mdbx_touch_dbi(MDBX_cursor *mc) {
|
||||
mdbx_cassert(mc, (*mc->mc_dbistate & (DBI_DIRTY | DBI_DUPDATA)) == 0);
|
||||
mdbx_cassert(mc, (*mc->mc_dbistate & DBI_DIRTY) == 0);
|
||||
*mc->mc_dbistate |= DBI_DIRTY;
|
||||
mc->mc_txn->mt_flags |= MDBX_TXN_DIRTY;
|
||||
if (mc->mc_dbi >= CORE_DBS) {
|
||||
@ -13852,7 +13852,7 @@ static int mdbx_touch_dbi(MDBX_cursor *mc) {
|
||||
* [in] mc The cursor to operate on. */
|
||||
static int mdbx_cursor_touch(MDBX_cursor *mc) {
|
||||
int rc = MDBX_SUCCESS;
|
||||
if (unlikely((*mc->mc_dbistate & (DBI_DIRTY | DBI_DUPDATA)) == 0)) {
|
||||
if (unlikely((*mc->mc_dbistate & DBI_DIRTY) == 0)) {
|
||||
rc = mdbx_touch_dbi(mc);
|
||||
if (unlikely(rc != MDBX_SUCCESS))
|
||||
return rc;
|
||||
@ -14139,7 +14139,7 @@ int mdbx_cursor_put(MDBX_cursor *mc, const MDBX_val *key, MDBX_val *data,
|
||||
MDBX_page *np;
|
||||
/* new database, write a root leaf page */
|
||||
mdbx_debug("%s", "allocating new root leaf page");
|
||||
if (unlikely((*mc->mc_dbistate & (DBI_DIRTY | DBI_DUPDATA)) == 0)) {
|
||||
if (unlikely((*mc->mc_dbistate & DBI_DIRTY) == 0)) {
|
||||
rc2 = mdbx_touch_dbi(mc);
|
||||
if (unlikely(rc2 != MDBX_SUCCESS))
|
||||
return rc2;
|
||||
@ -15139,11 +15139,12 @@ static int mdbx_xcursor_init0(MDBX_cursor *mc) {
|
||||
}
|
||||
|
||||
mx->mx_cursor.mc_xcursor = NULL;
|
||||
mx->mx_cursor.mc_next = NULL;
|
||||
mx->mx_cursor.mc_txn = mc->mc_txn;
|
||||
mx->mx_cursor.mc_db = &mx->mx_db;
|
||||
mx->mx_cursor.mc_dbx = &mx->mx_dbx;
|
||||
mx->mx_cursor.mc_dbi = mc->mc_dbi;
|
||||
mx->mx_cursor.mc_dbistate = &mx->mx_dbistate;
|
||||
mx->mx_cursor.mc_dbistate = mc->mc_dbistate;
|
||||
mx->mx_cursor.mc_snum = 0;
|
||||
mx->mx_cursor.mc_top = 0;
|
||||
mx->mx_cursor.mc_flags = C_SUB | (mc->mc_flags & (C_COPYING | C_SKIPORD));
|
||||
@ -15248,7 +15249,6 @@ static int mdbx_xcursor_init1(MDBX_cursor *mc, MDBX_node *node,
|
||||
|
||||
mdbx_debug("Sub-db -%u root page %" PRIaPGNO, mx->mx_cursor.mc_dbi,
|
||||
mx->mx_db.md_root);
|
||||
mx->mx_dbistate = DBI_VALID | DBI_USRVALID | DBI_DUPDATA;
|
||||
return MDBX_SUCCESS;
|
||||
}
|
||||
|
||||
@ -15273,7 +15273,6 @@ static int mdbx_xcursor_init2(MDBX_cursor *mc, MDBX_xcursor *src_mx,
|
||||
mx->mx_cursor.mc_top = 0;
|
||||
mx->mx_cursor.mc_flags |= C_INITIALIZED;
|
||||
mx->mx_cursor.mc_ki[0] = 0;
|
||||
mx->mx_dbistate = DBI_VALID | DBI_USRVALID | DBI_DUPDATA;
|
||||
}
|
||||
|
||||
mx->mx_dbx.md_klen_min = src_mx->mx_dbx.md_klen_min;
|
||||
|
@ -774,8 +774,7 @@ struct MDBX_txn {
|
||||
#define DBI_CREAT MDBX_DBI_CREAT /* Named-DB handle created in this txn */
|
||||
#define DBI_VALID 0x10 /* DB handle is valid, see also DB_VALID */
|
||||
#define DBI_USRVALID 0x20 /* As DB_VALID, but not set for FREE_DBI */
|
||||
#define DBI_DUPDATA 0x40 /* DB is MDBX_DUPSORT data */
|
||||
#define DBI_AUDITED 0x80 /* Internal flag for accounting during audit */
|
||||
#define DBI_AUDITED 0x40 /* Internal flag for accounting during audit */
|
||||
/* Array of flags for each DB */
|
||||
uint8_t *mt_dbistate;
|
||||
/* Number of DB records in use, or 0 when the txn is finished.
|
||||
@ -894,8 +893,6 @@ typedef struct MDBX_xcursor {
|
||||
MDBX_db mx_db;
|
||||
/* The auxiliary DB record for this Dup DB */
|
||||
MDBX_dbx mx_dbx;
|
||||
/* The mt_dbistate for this Dup DB */
|
||||
uint8_t mx_dbistate;
|
||||
} MDBX_xcursor;
|
||||
|
||||
typedef struct MDBX_cursor_couple {
|
||||
|
Loading…
x
Reference in New Issue
Block a user