mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:24:13 +08:00
mdbx: shrink dbi table immediately in the mdbx_dbi_close_locked()
.
Change-Id: Idaa5ec9791b5ffa4305e7f9f7a625fba5f956dd9
This commit is contained in:
parent
de13d6c823
commit
b0d449565d
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user