mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-10 11:44:12 +08:00
mdbx: backport - avoid empty and unneeded large/overflow pages (squashed).
This commit is contained in:
parent
d2854e0760
commit
5049c86517
@ -7906,7 +7906,10 @@ int mdbx_cursor_put(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data,
|
|||||||
if (F_ISSET(leaf->mn_flags, F_BIGDATA)) {
|
if (F_ISSET(leaf->mn_flags, F_BIGDATA)) {
|
||||||
MDBX_page *omp;
|
MDBX_page *omp;
|
||||||
pgno_t pg;
|
pgno_t pg;
|
||||||
int level, ovpages, dpages = OVPAGES(env, data->iov_len);
|
int level, ovpages,
|
||||||
|
dpages = (LEAFSIZE(key, data) > env->me_nodemax)
|
||||||
|
? OVPAGES(env, data->iov_len)
|
||||||
|
: 0;
|
||||||
|
|
||||||
memcpy(&pg, olddata.iov_base, sizeof(pg));
|
memcpy(&pg, olddata.iov_base, sizeof(pg));
|
||||||
if (unlikely((rc2 = mdbx_page_get(mc, pg, &omp, &level)) != 0))
|
if (unlikely((rc2 = mdbx_page_get(mc, pg, &omp, &level)) != 0))
|
||||||
@ -7914,7 +7917,8 @@ int mdbx_cursor_put(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data,
|
|||||||
ovpages = omp->mp_pages;
|
ovpages = omp->mp_pages;
|
||||||
|
|
||||||
/* Is the ov page large enough? */
|
/* Is the ov page large enough? */
|
||||||
if (ovpages >= dpages) {
|
if (ovpages ==
|
||||||
|
/* LY: add configuragle theshold to keep reserve space */ dpages) {
|
||||||
if (!(omp->mp_flags & P_DIRTY) &&
|
if (!(omp->mp_flags & P_DIRTY) &&
|
||||||
(level || (env->me_flags & MDBX_WRITEMAP))) {
|
(level || (env->me_flags & MDBX_WRITEMAP))) {
|
||||||
rc = mdbx_page_unspill(mc->mc_txn, omp, &omp);
|
rc = mdbx_page_unspill(mc->mc_txn, omp, &omp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user