From 1be4140abf568629d92d10386c582ad57f2fe25a Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Mon, 31 Aug 2015 21:43:00 +0300 Subject: [PATCH] lmdb: mdb_chk allows interruption of b-tree travesersal. Change-Id: Ia59236dcb575203baebf9e65310cdf1e700c33ce --- mdb_chk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mdb_chk.c b/mdb_chk.c index d91b11f0..228bf133 100644 --- a/mdb_chk.c +++ b/mdb_chk.c @@ -223,7 +223,7 @@ static int pgvisitor(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi, } while(--pgnumber); } - return MDB_SUCCESS; + return gotsignal ? EINTR : MDB_SUCCESS; } typedef int (visitor)(size_t record_number, MDB_val *key, MDB_val* data); @@ -696,7 +696,11 @@ int main(int argc, char *argv[]) rc = mdb_env_pgwalk(txn, pgvisitor, NULL); if (rc) { - error("mdb_env_pgwalk failed, error %d %s\n", rc, mdb_strerror(rc)); + if (rc == EINTR && gotsignal) { + print(" - interrupted by signal\n"); + } else { + error("mdb_env_pgwalk failed, error %d %s\n", rc, mdb_strerror(rc)); + } goto bailout; } for( n = 0; n < lastpgno; ++n)