mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-21 18:18:21 +08:00
mdbx: simplify page-merge for LEAF2.
Change-Id: I25ad34f02b86b47562fc3c74f5454432f687cbde
This commit is contained in:
parent
5e2067decd
commit
d3e609d7ff
18
src/core.c
18
src/core.c
@ -13823,21 +13823,17 @@ static int mdbx_page_merge(MDBX_cursor *csrc, MDBX_cursor *cdst) {
|
|||||||
if (unlikely(rc))
|
if (unlikely(rc))
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
const MDBX_node *lowest;
|
|
||||||
const MDBX_page *mp = mn.mc_pg[mn.mc_top];
|
const MDBX_page *mp = mn.mc_pg[mn.mc_top];
|
||||||
if (unlikely(IS_LEAF2(mp))) {
|
if (likely(!IS_LEAF2(mp))) {
|
||||||
mdbx_cassert(&mn, mn.mc_top > csrc->mc_top);
|
|
||||||
unsigned i = mn.mc_top;
|
|
||||||
do
|
|
||||||
mp = mn.mc_pg[--i];
|
|
||||||
while (i && IS_BRANCH(mp) && mn.mc_ki[i] == 0);
|
|
||||||
lowest = page_node(mp, mn.mc_ki[i]);
|
|
||||||
} else {
|
|
||||||
mdbx_cassert(&mn, IS_LEAF(mp));
|
mdbx_cassert(&mn, IS_LEAF(mp));
|
||||||
lowest = page_node(mp, 0);
|
const MDBX_node *lowest = page_node(mp, 0);
|
||||||
}
|
|
||||||
key.iov_len = node_ks(lowest);
|
key.iov_len = node_ks(lowest);
|
||||||
key.iov_base = node_key(lowest);
|
key.iov_base = node_key(lowest);
|
||||||
|
} else {
|
||||||
|
mdbx_cassert(&mn, mn.mc_top > csrc->mc_top);
|
||||||
|
key.iov_len = mp->mp_leaf2_ksize;
|
||||||
|
key.iov_base = page_leaf2key(mp, mn.mc_ki[mn.mc_top], key.iov_len);
|
||||||
|
}
|
||||||
mdbx_cassert(&mn, key.iov_len >= csrc->mc_dbx->md_klen_min);
|
mdbx_cassert(&mn, key.iov_len >= csrc->mc_dbx->md_klen_min);
|
||||||
mdbx_cassert(&mn, key.iov_len <= csrc->mc_dbx->md_klen_max);
|
mdbx_cassert(&mn, key.iov_len <= csrc->mc_dbx->md_klen_max);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user