From 7d249c97adf34cf9d6861a47e37c1c7202dd62a8 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 27 Apr 2021 23:16:28 +0300 Subject: [PATCH] mdbx: double dirtyroom reserve for page stack. Related to https://github.com/erthink/libmdbx/issues/186 Change-Id: I211fc9c849c9a45254e699d713475898fd20a58e --- src/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 7016bc00..95493026 100644 --- a/src/core.c +++ b/src/core.c @@ -5326,7 +5326,10 @@ static int mdbx_cursor_spill(MDBX_cursor *mc, const MDBX_val *key, if (mc->mc_dbi > MAIN_DBI) need += txn->mt_dbs[MAIN_DBI].md_depth + 3; } - /* 4) Factor the key+data which to be put in */ + /* 4) Double the page chain estimation + * for extensively splitting, rebalance and merging */ + need += need; + /* 5) Factor the key+data which to be put in */ need += bytes2pgno(txn->mt_env, node_size(key, data)) + 1; return mdbx_txn_spill(txn, mc, need); }