mirror of
https://github.com/isar/libmdbx.git
synced 2025-04-27 19:22:26 +08:00
mdbx: add MDBX_TXNID_STEP macro for debugging.
Change-Id: I4768c8b39f3317ec3a5da8627d736f2f28bf0d51
This commit is contained in:
parent
8467552f0b
commit
b84bb4f805
@ -2707,7 +2707,7 @@ static __hot txnid_t mdbx_recent_steady_txnid(const MDBX_env *env) {
|
|||||||
static __hot txnid_t mdbx_reclaiming_detent(const MDBX_env *env) {
|
static __hot txnid_t mdbx_reclaiming_detent(const MDBX_env *env) {
|
||||||
if (F_ISSET(env->me_flags, MDBX_UTTERLY_NOSYNC))
|
if (F_ISSET(env->me_flags, MDBX_UTTERLY_NOSYNC))
|
||||||
return likely(env->me_txn0->mt_owner == mdbx_thread_self())
|
return likely(env->me_txn0->mt_owner == mdbx_thread_self())
|
||||||
? env->me_txn0->mt_txnid - 1
|
? env->me_txn0->mt_txnid - MDBX_TXNID_STEP
|
||||||
: mdbx_recent_committed_txnid(env);
|
: mdbx_recent_committed_txnid(env);
|
||||||
|
|
||||||
return mdbx_recent_steady_txnid(env);
|
return mdbx_recent_steady_txnid(env);
|
||||||
@ -4016,11 +4016,7 @@ static int mdbx_txn_renew0(MDBX_txn *txn, unsigned flags) {
|
|||||||
mdbx_jitter4testing(false);
|
mdbx_jitter4testing(false);
|
||||||
txn->mt_canary = meta->mm_canary;
|
txn->mt_canary = meta->mm_canary;
|
||||||
const txnid_t snap = mdbx_meta_txnid_stable(env, meta);
|
const txnid_t snap = mdbx_meta_txnid_stable(env, meta);
|
||||||
#if MDBX_DEBUG
|
txn->mt_txnid = snap + MDBX_TXNID_STEP;
|
||||||
txn->mt_txnid = snap + UINT32_MAX / 3;
|
|
||||||
#else
|
|
||||||
txn->mt_txnid = snap + 1;
|
|
||||||
#endif
|
|
||||||
if (unlikely(txn->mt_txnid >= SAFE64_INVALID_THRESHOLD)) {
|
if (unlikely(txn->mt_txnid >= SAFE64_INVALID_THRESHOLD)) {
|
||||||
mdbx_debug("txnid overflow!");
|
mdbx_debug("txnid overflow!");
|
||||||
rc = MDBX_TXN_FULL;
|
rc = MDBX_TXN_FULL;
|
||||||
|
@ -280,6 +280,11 @@ typedef uint32_t pgno_t;
|
|||||||
typedef uint64_t txnid_t;
|
typedef uint64_t txnid_t;
|
||||||
#define PRIaTXN PRIi64
|
#define PRIaTXN PRIi64
|
||||||
#define MIN_TXNID UINT64_C(1)
|
#define MIN_TXNID UINT64_C(1)
|
||||||
|
/* LY: for testing non-atomic 64-bit txnid on 32-bit arches.
|
||||||
|
* #define MDBX_TXNID_STEP (UINT32_MAX / 3) */
|
||||||
|
#ifndef MDBX_TXNID_STEP
|
||||||
|
#define MDBX_TXNID_STEP 1
|
||||||
|
#endif /* MDBX_TXNID_STEP */
|
||||||
|
|
||||||
/* Used for offsets within a single page.
|
/* Used for offsets within a single page.
|
||||||
* Since memory pages are typically 4 or 8KB in size, 12-13 bits,
|
* Since memory pages are typically 4 or 8KB in size, 12-13 bits,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user