mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:04:13 +08:00
mdbx: drop unused debug features.
This commit is contained in:
parent
60fed8bbca
commit
77f0e5e38e
7
mdbx.h
7
mdbx.h
@ -1550,16 +1550,11 @@ LIBMDBX_API MDBX_oom_func *mdbx_env_get_oomfunc(MDBX_env *env);
|
|||||||
#define MDBX_DBG_TRACE 4
|
#define MDBX_DBG_TRACE 4
|
||||||
#define MDBX_DBG_EXTRA 8
|
#define MDBX_DBG_EXTRA 8
|
||||||
#define MDBX_DBG_AUDIT 16
|
#define MDBX_DBG_AUDIT 16
|
||||||
#define MDBX_DBG_EDGE 32
|
|
||||||
|
|
||||||
/* LY: a "don't touch" value */
|
|
||||||
#define MDBX_DBG_DNT (-1L)
|
|
||||||
|
|
||||||
typedef void MDBX_debug_func(int type, const char *function, int line,
|
typedef void MDBX_debug_func(int type, const char *function, int line,
|
||||||
const char *msg, va_list args);
|
const char *msg, va_list args);
|
||||||
|
|
||||||
LIBMDBX_API int mdbx_setup_debug(int flags, MDBX_debug_func *logger,
|
LIBMDBX_API int mdbx_setup_debug(int flags, MDBX_debug_func *logger);
|
||||||
long edge_txn);
|
|
||||||
|
|
||||||
typedef int MDBX_pgvisitor_func(uint64_t pgno, unsigned pgnumber, void *ctx,
|
typedef int MDBX_pgvisitor_func(uint64_t pgno, unsigned pgnumber, void *ctx,
|
||||||
const char *dbi, const char *type, int nentries,
|
const char *dbi, const char *type, int nentries,
|
||||||
|
28
src/mdbx.c
28
src/mdbx.c
@ -502,12 +502,6 @@ int mdbx_runtime_flags = MDBX_DBG_PRINT
|
|||||||
|
|
||||||
MDBX_debug_func *mdbx_debug_logger;
|
MDBX_debug_func *mdbx_debug_logger;
|
||||||
|
|
||||||
int mdbx_setup_debug(int flags, MDBX_debug_func *logger, long edge_txn);
|
|
||||||
|
|
||||||
#if MDBX_DEBUG
|
|
||||||
txnid_t mdbx_debug_edge;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int mdbx_page_alloc(MDBX_cursor *mc, int num, MDBX_page **mp, int flags);
|
static int mdbx_page_alloc(MDBX_cursor *mc, int num, MDBX_page **mp, int flags);
|
||||||
static int mdbx_page_new(MDBX_cursor *mc, uint32_t flags, int num,
|
static int mdbx_page_new(MDBX_cursor *mc, uint32_t flags, int num,
|
||||||
MDBX_page **mp);
|
MDBX_page **mp);
|
||||||
@ -2276,15 +2270,6 @@ static int mdbx_txn_renew0(MDBX_txn *txn, unsigned flags) {
|
|||||||
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);
|
||||||
txn->mt_txnid = snap + 1;
|
txn->mt_txnid = snap + 1;
|
||||||
#if MDBX_DEBUG
|
|
||||||
if (unlikely(txn->mt_txnid == mdbx_debug_edge)) {
|
|
||||||
if (!mdbx_debug_logger)
|
|
||||||
mdbx_runtime_flags |=
|
|
||||||
MDBX_DBG_TRACE | MDBX_DBG_EXTRA | MDBX_DBG_AUDIT | MDBX_DBG_ASSERT;
|
|
||||||
mdbx_debug_log(MDBX_DBG_EDGE, __FUNCTION__, __LINE__,
|
|
||||||
"on/off edge (txn %" PRIaTXN ")", txn->mt_txnid);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (unlikely(txn->mt_txnid < snap)) {
|
if (unlikely(txn->mt_txnid < snap)) {
|
||||||
mdbx_debug("txnid overflow!");
|
mdbx_debug("txnid overflow!");
|
||||||
rc = MDBX_TXN_FULL;
|
rc = MDBX_TXN_FULL;
|
||||||
@ -9566,17 +9551,10 @@ int __cold mdbx_reader_check0(MDBX_env *env, int rdt_locked, int *dead) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __cold mdbx_setup_debug(int flags, MDBX_debug_func *logger, long edge_txn) {
|
int __cold mdbx_setup_debug(int flags, MDBX_debug_func *logger) {
|
||||||
unsigned ret = mdbx_runtime_flags;
|
unsigned ret = mdbx_runtime_flags;
|
||||||
if (flags != (int)MDBX_DBG_DNT)
|
mdbx_runtime_flags = flags;
|
||||||
mdbx_runtime_flags = flags;
|
mdbx_debug_logger = logger;
|
||||||
if (logger != (MDBX_debug_func *)MDBX_DBG_DNT)
|
|
||||||
mdbx_debug_logger = logger;
|
|
||||||
if (edge_txn != (long)MDBX_DBG_DNT) {
|
|
||||||
#if MDBX_DEBUG
|
|
||||||
mdbx_debug_edge = edge_txn;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ void testcase::db_prepare() {
|
|||||||
mdbx_dbg_opts |= MDBX_DBG_TRACE;
|
mdbx_dbg_opts |= MDBX_DBG_TRACE;
|
||||||
if (config.params.loglevel <= logging::verbose)
|
if (config.params.loglevel <= logging::verbose)
|
||||||
mdbx_dbg_opts |= MDBX_DBG_PRINT;
|
mdbx_dbg_opts |= MDBX_DBG_PRINT;
|
||||||
int rc = mdbx_setup_debug(mdbx_dbg_opts, mdbx_debug_logger, MDBX_DBG_DNT);
|
int rc = mdbx_setup_debug(mdbx_dbg_opts, mdbx_debug_logger);
|
||||||
log_info("set mdbx debug-opts: 0x%02x", rc);
|
log_info("set mdbx debug-opts: 0x%02x", rc);
|
||||||
|
|
||||||
MDBX_env *env = nullptr;
|
MDBX_env *env = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user