|
|
@ -259,9 +259,12 @@ typedef ID txnid_t; |
|
|
|
#if !(__STDC_VERSION__ >= 199901L || defined(__GNUC__)) |
|
|
|
#if !(__STDC_VERSION__ >= 199901L || defined(__GNUC__)) |
|
|
|
# define DPRINTF (void) /* Vararg macros may be unsupported */ |
|
|
|
# define DPRINTF (void) /* Vararg macros may be unsupported */ |
|
|
|
#elif MDB_DEBUG |
|
|
|
#elif MDB_DEBUG |
|
|
|
|
|
|
|
static int mdb_debug; |
|
|
|
|
|
|
|
static int mdb_debug_start; |
|
|
|
|
|
|
|
|
|
|
|
/** Print a debug message with printf formatting. */ |
|
|
|
/** Print a debug message with printf formatting. */ |
|
|
|
# define DPRINTF(fmt, ...) /**< Requires 2 or more args */ \ |
|
|
|
# define DPRINTF(fmt, ...) /**< Requires 2 or more args */ \ |
|
|
|
fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, __VA_ARGS__) |
|
|
|
if (mdb_debug) fprintf(stderr, "%s:%d " fmt "\n", __func__, __LINE__, __VA_ARGS__) |
|
|
|
#else |
|
|
|
#else |
|
|
|
# define DPRINTF(fmt, ...) ((void) 0) |
|
|
|
# define DPRINTF(fmt, ...) ((void) 0) |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -1576,6 +1579,10 @@ mdb_txn_renew0(MDB_txn *txn) |
|
|
|
if (env->me_wtxnid < txn->mt_txnid) |
|
|
|
if (env->me_wtxnid < txn->mt_txnid) |
|
|
|
mt_dbflag = DB_STALE; |
|
|
|
mt_dbflag = DB_STALE; |
|
|
|
txn->mt_txnid++; |
|
|
|
txn->mt_txnid++; |
|
|
|
|
|
|
|
#if MDB_DEBUG |
|
|
|
|
|
|
|
if (txn->mt_txnid == mdb_debug_start) |
|
|
|
|
|
|
|
mdb_debug = 1; |
|
|
|
|
|
|
|
#endif |
|
|
|
txn->mt_toggle = env->me_txns->mti_me_toggle; |
|
|
|
txn->mt_toggle = env->me_txns->mti_me_toggle; |
|
|
|
txn->mt_u.dirty_list = env->me_dirty_list; |
|
|
|
txn->mt_u.dirty_list = env->me_dirty_list; |
|
|
|
txn->mt_u.dirty_list[0].mid = 0; |
|
|
|
txn->mt_u.dirty_list[0].mid = 0; |
|
|
@ -5765,11 +5772,12 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno |
|
|
|
* When the size of the data items is much smaller than |
|
|
|
* When the size of the data items is much smaller than |
|
|
|
* one-half of a page, this check is irrelevant. |
|
|
|
* one-half of a page, this check is irrelevant. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (IS_LEAF(mp) && nkeys < 16) { |
|
|
|
if (IS_LEAF(mp)) { |
|
|
|
unsigned int psize, nsize; |
|
|
|
unsigned int psize, nsize; |
|
|
|
/* Maximum free space in an empty page */ |
|
|
|
/* Maximum free space in an empty page */ |
|
|
|
pmax = mc->mc_txn->mt_env->me_psize - PAGEHDRSZ; |
|
|
|
pmax = mc->mc_txn->mt_env->me_psize - PAGEHDRSZ; |
|
|
|
nsize = mdb_leaf_size(mc->mc_txn->mt_env, newkey, newdata); |
|
|
|
nsize = mdb_leaf_size(mc->mc_txn->mt_env, newkey, newdata); |
|
|
|
|
|
|
|
if ((nkeys < 20) || (nsize > pmax/4)) { |
|
|
|
if (newindx <= split_indx) { |
|
|
|
if (newindx <= split_indx) { |
|
|
|
psize = nsize; |
|
|
|
psize = nsize; |
|
|
|
newpos = 0; |
|
|
|
newpos = 0; |
|
|
@ -5806,6 +5814,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* First find the separating key between the split pages.
|
|
|
|
/* First find the separating key between the split pages.
|
|
|
|
* The case where newindx == split_indx is ambiguous; the |
|
|
|
* The case where newindx == split_indx is ambiguous; the |
|
|
@ -5918,6 +5927,7 @@ newsep: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rc = mdb_node_add(mc, j, &rkey, rdata, pgno, flags); |
|
|
|
rc = mdb_node_add(mc, j, &rkey, rdata, pgno, flags); |
|
|
|
|
|
|
|
if (rc) break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nkeys = NUMKEYS(copy); |
|
|
|
nkeys = NUMKEYS(copy); |
|
|
|