mdbx: drop unused debug features.

This commit is contained in:
Leo Yuriev 2017-05-27 20:03:46 +03:00
parent 60fed8bbca
commit 77f0e5e38e
3 changed files with 5 additions and 32 deletions

7
mdbx.h
View File

@ -1550,16 +1550,11 @@ LIBMDBX_API MDBX_oom_func *mdbx_env_get_oomfunc(MDBX_env *env);
#define MDBX_DBG_TRACE 4
#define MDBX_DBG_EXTRA 8
#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,
const char *msg, va_list args);
LIBMDBX_API int mdbx_setup_debug(int flags, MDBX_debug_func *logger,
long edge_txn);
LIBMDBX_API int mdbx_setup_debug(int flags, MDBX_debug_func *logger);
typedef int MDBX_pgvisitor_func(uint64_t pgno, unsigned pgnumber, void *ctx,
const char *dbi, const char *type, int nentries,

View File

@ -502,12 +502,6 @@ int mdbx_runtime_flags = MDBX_DBG_PRINT
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_new(MDBX_cursor *mc, uint32_t flags, int num,
MDBX_page **mp);
@ -2276,15 +2270,6 @@ static int mdbx_txn_renew0(MDBX_txn *txn, unsigned flags) {
txn->mt_canary = meta->mm_canary;
const txnid_t snap = mdbx_meta_txnid_stable(env, meta);
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)) {
mdbx_debug("txnid overflow!");
rc = MDBX_TXN_FULL;
@ -9566,17 +9551,10 @@ int __cold mdbx_reader_check0(MDBX_env *env, int rdt_locked, int *dead) {
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;
if (flags != (int)MDBX_DBG_DNT)
mdbx_runtime_flags = flags;
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
}
mdbx_runtime_flags = flags;
mdbx_debug_logger = logger;
return ret;
}

View File

@ -119,7 +119,7 @@ void testcase::db_prepare() {
mdbx_dbg_opts |= MDBX_DBG_TRACE;
if (config.params.loglevel <= logging::verbose)
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);
MDBX_env *env = nullptr;