From 15a9fb9b98416d27db997e8823dabdc4d0bd72a9 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 22 Aug 2018 00:35:26 +0300 Subject: [PATCH] mdbx-tools: refine 'mismatch idl length' error message. Change-Id: I64ed835035f2318b295353f9360fc4d4da2afa28 --- src/tools/mdbx_chk.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index 5acf7186..8fec23e3 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -343,9 +343,13 @@ static int handle_freedb(const uint64_t record_number, const MDBX_val *key, if (number < 1 || number > MDBX_LIST_MAX) problem_add("entry", record_number, "wrong idl length", "%" PRIiPTR "", number); - else if ((number + 1) * sizeof(pgno_t) != data->iov_len) - problem_add("entry", record_number, "mismatch idl length", - "%" PRIuSIZE " != %" PRIuSIZE "", + else if ((number + 1) * sizeof(pgno_t) > data->iov_len) + problem_add("entry", record_number, "trimmed idl", + "%" PRIuSIZE " > %" PRIuSIZE " (corruption)", + (number + 1) * sizeof(pgno_t), data->iov_len); + else if ((number + 1) * sizeof(pgno_t) < data->iov_len) + problem_add("entry", record_number, "extra idl space", + "%" PRIuSIZE " < %" PRIuSIZE " (minor, not a trouble)", (number + 1) * sizeof(pgno_t), data->iov_len); else { freedb_pages += number;