From a8e2288537a8aac94de3f9eac437d6b58bb97267 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Sun, 22 Nov 2015 00:59:55 +0000 Subject: [PATCH] mdbx: backport - ITS#8319 mdb_load: explain readline and mdb_cursor_put errors. Change-Id: I99e8ff220bb37109da83bb6088be7597b52c6f00 --- CHANGES | 1 + mdb_load.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 3f9084f0..df82a13c 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,7 @@ LMDB 0.9.17 Release Engineering Fix ITS#8313 mdb_rebalance dummy cursor Fix ITS#8315 dirty_room in nested txn Fix ITS#8316 page_merge cursor tracking + Fix ITS#8319 mdb_load error messages Fix ITS#8321 cursor tracking Added mdb_txn_id() (ITS#7994) Added robust mutex support diff --git a/mdb_load.c b/mdb_load.c index 97e81e02..c81a0fa8 100644 --- a/mdb_load.c +++ b/mdb_load.c @@ -399,20 +399,22 @@ int main(int argc, char *argv[]) while(1) { rc = readline(&key, &kbuf); - if (rc == EOF) + if (rc) /* rc == EOF */ break; - if (rc) - goto txn_abort; rc = readline(&data, &dbuf); - if (rc) + if (rc) { + fprintf(stderr, "%s: line %" Z "d: failed to read key value\n", prog, lineno); goto txn_abort; + } rc = mdb_cursor_put(mc, &key, &data, putflags); if (rc == MDB_KEYEXIST && putflags) continue; - if (rc) + if (rc) { + fprintf(stderr, "mdb_cursor_put failed, error %d %s\n", rc, mdb_strerror(rc)); goto txn_abort; + } batch++; if (batch == 100) { rc = mdb_txn_commit(txn);