From 9b5e28e8e69b835f8ba37c0c67c56b99d2a24a01 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Wed, 16 Aug 2017 08:44:07 +0300 Subject: [PATCH] mdbx: fix mdbx_setup_dxb() for a case when db-size not (pre)configured by user. Fix https://github.com/leo-yuriev/libmdbx/issues/11 Change-Id: I6fccd4877fed563cfb3a03f887bbba73eff5ac84 --- src/mdbx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mdbx.c b/src/mdbx.c index 240c115d..22af1b1d 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -4757,6 +4757,13 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) { meta.mm_txnid_a, mdbx_durable_str(&meta)); } mdbx_ensure(env, meta.mm_geo.now >= meta.mm_geo.next); + } else { + /* geo-params not pre-configured by used, fetch present from meta. */ + env->me_dbgeo.now = pgno2bytes(env, meta.mm_geo.now); + env->me_dbgeo.lower = pgno2bytes(env, meta.mm_geo.lower); + env->me_dbgeo.upper = pgno2bytes(env, meta.mm_geo.upper); + env->me_dbgeo.grow = pgno2bytes(env, meta.mm_geo.grow); + env->me_dbgeo.shrink = pgno2bytes(env, meta.mm_geo.shrink); } uint64_t filesize_before_mmap;