mdbx: don't shrink DB less largest reader inside mdbx_env_set_geometry().

Change-Id: I42a5d3a08313fb9590a6730bc0dc06c7b4f16634
This commit is contained in:
Leonid Yuriev 2019-08-22 22:33:18 +03:00
parent 0c63859459
commit de88707946

View File

@ -5796,6 +5796,10 @@ mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now,
need_unlock = true;
}
MDBX_meta *head = mdbx_meta_head(env);
if (!inside_txn) {
env->me_txn0->mt_txnid = meta_txnid(env, head, false);
mdbx_find_oldest(env->me_txn0);
}
if (pagesize < 0)
pagesize = env->me_psize;
@ -5815,7 +5819,8 @@ mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now,
if (shrink_threshold < 0)
shrink_threshold = pgno2bytes(env, head->mm_geo.shrink);
const size_t usedbytes = pgno2bytes(env, head->mm_geo.next);
const size_t usedbytes =
pgno2bytes(env, mdbx_find_largest(env, head->mm_geo.next));
if ((size_t)size_upper < usedbytes) {
rc = MDBX_MAP_FULL;
goto bailout;