From 77f0e5e38ef2d84b74b543b69c36a8d6441d4c10 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Sat, 27 May 2017 20:03:46 +0300 Subject: [PATCH] mdbx: drop unused debug features. --- mdbx.h | 7 +------ src/mdbx.c | 28 +++------------------------- test/test.cc | 2 +- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/mdbx.h b/mdbx.h index 45668cf6..07fa432e 100644 --- a/mdbx.h +++ b/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_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, diff --git a/src/mdbx.c b/src/mdbx.c index c2cf517f..4042969e 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -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; } diff --git a/test/test.cc b/test/test.cc index 44d59209..0d29ad8e 100644 --- a/test/test.cc +++ b/test/test.cc @@ -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;