lmdb: fix b-tree walking bug in case empty db.

Change-Id: I28c0985493327babe4d2ae5c6cd56116a26e6034
This commit is contained in:
Leo Yuriev 2015-08-05 13:23:30 +03:00
parent a243a38aa6
commit 595f9e700d

8
mdb.c
View File

@ -9727,6 +9727,10 @@ mdb_env_walk(mdb_walk_ctx_t *ctx, const char* dbi, pgno_t pg, int flags, int dee
int rc;
unsigned i;
/* Empty DB, nothing to do */
if (pg == P_INVALID)
return MDB_SUCCESS;
if (deep < 2) {
if ((rc = mdb_page_get(ctx->mw_txn, pg, &mp, NULL)) != 0)
return rc;
@ -9736,10 +9740,6 @@ mdb_env_walk(mdb_walk_ctx_t *ctx, const char* dbi, pgno_t pg, int flags, int dee
return rc;
}
/* Empty DB, nothing to do */
if (pg == P_INVALID)
return MDB_SUCCESS;
mc.mc_snum = 1;
mc.mc_top = 0;
mc.mc_txn = ctx->mw_txn;