mdbx: shrink dbi table immediately in the mdbx_dbi_close_locked().

Change-Id: Idaa5ec9791b5ffa4305e7f9f7a625fba5f956dd9
This commit is contained in:
Leonid Yuriev 2021-03-05 01:27:40 +03:00
parent de13d6c823
commit b0d449565d

View File

@ -18809,8 +18809,13 @@ static int mdbx_dbi_close_locked(MDBX_env *env, MDBX_dbi dbi) {
env->me_dbxs[dbi].md_name.iov_base = NULL;
mdbx_free(ptr);
if (env->me_numdbs == dbi + 1)
env->me_numdbs = dbi;
if (env->me_numdbs == dbi + 1) {
unsigned i = env->me_numdbs;
do
--i;
while (i > CORE_DBS && !env->me_dbxs[i - 1].md_name.iov_base);
env->me_numdbs = i;
}
return MDBX_SUCCESS;
}