mdbx: minor refine mdbx_rebalance().

Change-Id: I10a6a208b173bdee1d325aa7b2624de879814647
This commit is contained in:
Leonid Yuriev 2020-11-03 03:01:02 +03:00
parent b209e91ad4
commit 37a1d546b7

View File

@ -14926,8 +14926,7 @@ static int mdbx_rebalance(MDBX_cursor *mc) {
mc->mc_db->md_overflow_pages == 0 &&
mc->mc_db->md_leaf_pages == 1);
/* Adjust cursors pointing to mp */
const MDBX_dbi dbi = mc->mc_dbi;
for (MDBX_cursor *m2 = mc->mc_txn->mt_cursors[dbi]; m2;
for (MDBX_cursor *m2 = mc->mc_txn->mt_cursors[mc->mc_dbi]; m2;
m2 = m2->mc_next) {
MDBX_cursor *m3 =
(mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2;
@ -14961,10 +14960,10 @@ static int mdbx_rebalance(MDBX_cursor *mc) {
}
/* Adjust other cursors pointing to mp */
MDBX_cursor *m2, *m3;
MDBX_dbi dbi = mc->mc_dbi;
for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2 = m2->mc_next) {
m3 = (mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2;
for (MDBX_cursor *m2 = mc->mc_txn->mt_cursors[mc->mc_dbi]; m2;
m2 = m2->mc_next) {
MDBX_cursor *m3 =
(mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2;
if (m3 == mc || !(m3->mc_flags & C_INITIALIZED))
continue;
if (m3->mc_pg[0] == mp) {
@ -15116,7 +15115,8 @@ static int mdbx_rebalance(MDBX_cursor *mc) {
mdbx_cassert(mc, rc || page_numkeys(mc->mc_pg[mc->mc_top]) >= minkeys);
return rc;
}
} else if (likely(right)) {
}
if (likely(right)) {
/* try merge with right */
mdbx_cassert(mc, page_numkeys(right) >= minkeys);
mn.mc_pg[mn.mc_top] = right;