|
|
@ -7643,9 +7643,9 @@ mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) |
|
|
|
uint16_t depth = cdst->mc_db->md_depth; |
|
|
|
uint16_t depth = cdst->mc_db->md_depth; |
|
|
|
mdb_cursor_pop(cdst); |
|
|
|
mdb_cursor_pop(cdst); |
|
|
|
rc = mdb_rebalance(cdst); |
|
|
|
rc = mdb_rebalance(cdst); |
|
|
|
/* Did the tree shrink? */ |
|
|
|
/* Did the tree height change? */ |
|
|
|
if (depth > cdst->mc_db->md_depth) |
|
|
|
if (depth != cdst->mc_db->md_depth) |
|
|
|
snum--; |
|
|
|
snum += cdst->mc_db->md_depth - depth; |
|
|
|
cdst->mc_snum = snum; |
|
|
|
cdst->mc_snum = snum; |
|
|
|
cdst->mc_top = snum-1; |
|
|
|
cdst->mc_top = snum-1; |
|
|
|
} |
|
|
|
} |
|
|
@ -7837,7 +7837,7 @@ mdb_rebalance(MDB_cursor *mc) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= thresh && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) { |
|
|
|
if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= thresh && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) { |
|
|
|
rc = mdb_node_move(&mn, mc); |
|
|
|
rc = mdb_node_move(&mn, mc); |
|
|
|
if (mc->mc_ki[ptop]) { |
|
|
|
if (mc->mc_ki[mc->mc_top-1]) { |
|
|
|
oldki++; |
|
|
|
oldki++; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -8050,8 +8050,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno |
|
|
|
mc->mc_ki[0] = 0; |
|
|
|
mc->mc_ki[0] = 0; |
|
|
|
mc->mc_db->md_root = pp->mp_pgno; |
|
|
|
mc->mc_db->md_root = pp->mp_pgno; |
|
|
|
DPRINTF(("root split! new root = %"Z"u", pp->mp_pgno)); |
|
|
|
DPRINTF(("root split! new root = %"Z"u", pp->mp_pgno)); |
|
|
|
mc->mc_db->md_depth++; |
|
|
|
new_root = mc->mc_db->md_depth++; |
|
|
|
new_root = 1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Add left (implicit) pointer. */ |
|
|
|
/* Add left (implicit) pointer. */ |
|
|
|
if ((rc = mdb_node_add(mc, 0, NULL, NULL, mp->mp_pgno, 0)) != MDB_SUCCESS) { |
|
|
|
if ((rc = mdb_node_add(mc, 0, NULL, NULL, mp->mp_pgno, 0)) != MDB_SUCCESS) { |
|
|
@ -8364,7 +8363,7 @@ mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno |
|
|
|
if (new_root) { |
|
|
|
if (new_root) { |
|
|
|
int k; |
|
|
|
int k; |
|
|
|
/* root split */ |
|
|
|
/* root split */ |
|
|
|
for (k=m3->mc_top; k>=0; k--) { |
|
|
|
for (k=new_root; k>=0; k--) { |
|
|
|
m3->mc_ki[k+1] = m3->mc_ki[k]; |
|
|
|
m3->mc_ki[k+1] = m3->mc_ki[k]; |
|
|
|
m3->mc_pg[k+1] = m3->mc_pg[k]; |
|
|
|
m3->mc_pg[k+1] = m3->mc_pg[k]; |
|
|
|
} |
|
|
|
} |
|
|
|