Skip to content

Commit b8c1877

Browse files
committed
Cleanup: Add flag DB_DUPDATA, drop DB_DIRTY hack
1 parent b57bb99 commit b8c1877

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libraries/liblmdb/mdb.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,11 +1078,12 @@ struct MDB_txn {
10781078
* @ingroup internal
10791079
* @{
10801080
*/
1081-
#define DB_DIRTY 0x01 /**< DB was modified or is DUPSORT data */
1081+
#define DB_DIRTY 0x01 /**< DB was written in this txn */
10821082
#define DB_STALE 0x02 /**< Named-DB record is older than txnID */
10831083
#define DB_NEW 0x04 /**< Named-DB handle opened in this txn */
10841084
#define DB_VALID 0x08 /**< DB handle is valid, see also #MDB_VALID */
10851085
#define DB_USRVALID 0x10 /**< As #DB_VALID, but not set for #FREE_DBI */
1086+
#define DB_DUPDATA 0x20 /**< DB is #MDB_DUPSORT data */
10861087
/** @} */
10871088
/** In write txns, array of cursors for each DB */
10881089
MDB_cursor **mt_cursors;
@@ -6270,7 +6271,8 @@ mdb_cursor_touch(MDB_cursor *mc)
62706271
{
62716272
int rc = MDB_SUCCESS;
62726273

6273-
if (mc->mc_dbi >= CORE_DBS && !(*mc->mc_dbflag & DB_DIRTY)) {
6274+
if (mc->mc_dbi >= CORE_DBS && !(*mc->mc_dbflag & (DB_DIRTY|DB_DUPDATA))) {
6275+
/* Touch DB record of named DB */
62746276
MDB_cursor mc2;
62756277
MDB_xcursor mcx;
62766278
if (TXN_DBI_CHANGED(mc->mc_txn, mc->mc_dbi))
@@ -7331,7 +7333,7 @@ mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node)
73317333
}
73327334
DPRINTF(("Sub-db -%u root page %"Z"u", mx->mx_cursor.mc_dbi,
73337335
mx->mx_db.md_root));
7334-
mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */
7336+
mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DUPDATA;
73357337
#if UINT_MAX < SIZE_MAX
73367338
if (mx->mx_dbx.md_cmp == mdb_cmp_int && mx->mx_db.md_pad == sizeof(size_t))
73377339
mx->mx_dbx.md_cmp = mdb_cmp_clong;
@@ -7357,7 +7359,7 @@ mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata)
73577359
mx->mx_cursor.mc_top = 0;
73587360
mx->mx_cursor.mc_flags |= C_INITIALIZED;
73597361
mx->mx_cursor.mc_ki[0] = 0;
7360-
mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DIRTY; /* DB_DIRTY guides mdb_cursor_touch */
7362+
mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DUPDATA;
73617363
#if UINT_MAX < SIZE_MAX
73627364
mx->mx_dbx.md_cmp = src_mx->mx_dbx.md_cmp;
73637365
#endif

0 commit comments

Comments
 (0)