From ecffc831fa7394194e71904792ae32e0e9639d33 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Thu, 27 Feb 2020 16:04:00 +0300 Subject: [PATCH] mdbx-tools: avoids extra error messages "bad txn" from mdbx_chk when DB is corrupted. Change-Id: I6b92aced83bcf7e0c8e5c7108ddcf60714c9b30c --- src/tools/mdbx_chk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tools/mdbx_chk.c b/src/tools/mdbx_chk.c index e5dd539a..fd2a2048 100644 --- a/src/tools/mdbx_chk.c +++ b/src/tools/mdbx_chk.c @@ -559,6 +559,12 @@ static int process_db(MDBX_dbi dbi_handle, char *dbi_name, visitor *handler, uint64_t record_count = 0, dups = 0; uint64_t key_bytes = 0, data_bytes = 0; + if ((MDBX_TXN_FINISHED | MDBX_TXN_ERROR) & mdbx_txn_flags(txn)) { + print(" ! abort processing '%s' due to a previous error\n", + dbi_name ? dbi_name : "@MAIN"); + return MDBX_BAD_TXN; + } + if (dbi_handle == ~0u) { rc = mdbx_dbi_open(txn, dbi_name, 0, &dbi_handle); if (rc) {