From 2524a0e749eff6b89523cdd6dbcd90ab0569defc Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Sun, 21 Mar 2021 14:39:43 +0300 Subject: [PATCH] mdbx: output page type from `bad_page()`. Change-Id: I11e4931de26015204c26c116e91e4a0e02f909b4 --- src/core.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 59a9e9ba..69f8bd12 100644 --- a/src/core.c +++ b/src/core.c @@ -641,8 +641,32 @@ __cold static int MDBX_PRINTF_ARGS(2, 3) static const MDBX_page *prev; if (prev != mp) { prev = mp; + const char *type; + switch (mp->mp_flags & (P_BRANCH | P_LEAF | P_OVERFLOW | P_META | + P_LEAF2 | P_BAD | P_SUBP)) { + case P_BRANCH: + type = "branch"; + break; + case P_LEAF: + type = "leaf"; + break; + case P_LEAF | P_SUBP: + type = "subleaf"; + break; + case P_LEAF | P_LEAF2: + type = "dupfixed-leaf"; + break; + case P_LEAF | P_LEAF2 | P_SUBP: + type = "dupfixed-subleaf"; + break; + case P_OVERFLOW: + type = "large"; + break; + default: + type = "broken"; + } mdbx_debug_log(MDBX_LOG_ERROR, "badpage", 0, - "corrupted page #%u, mod-txnid %" PRIaTXN "\n", + "corrupted %s-page #%u, mod-txnid %" PRIaTXN "\n", type, mp->mp_pgno, mp->mp_txnid); }