lmdb: mdb_chk allows interruption of b-tree travesersal.

Change-Id: Ia59236dcb575203baebf9e65310cdf1e700c33ce
This commit is contained in:
Leo Yuriev 2015-08-31 21:43:00 +03:00
parent 37b3629329
commit 1be4140abf

View File

@ -223,7 +223,7 @@ static int pgvisitor(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi,
} while(--pgnumber); } while(--pgnumber);
} }
return MDB_SUCCESS; return gotsignal ? EINTR : MDB_SUCCESS;
} }
typedef int (visitor)(size_t record_number, MDB_val *key, MDB_val* data); 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); rc = mdb_env_pgwalk(txn, pgvisitor, NULL);
if (rc) { 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; goto bailout;
} }
for( n = 0; n < lastpgno; ++n) for( n = 0; n < lastpgno; ++n)