mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-13 14:27:59 +08:00
ITS#7538 fallout from ITS#7536 fix.
Allow leaf pages to have only 1 key.
This commit is contained in:
parent
3247d7cbd6
commit
77001f549b
@ -6250,7 +6250,7 @@ static int
|
|||||||
mdb_rebalance(MDB_cursor *mc)
|
mdb_rebalance(MDB_cursor *mc)
|
||||||
{
|
{
|
||||||
MDB_node *node;
|
MDB_node *node;
|
||||||
int rc;
|
int rc, minkeys;
|
||||||
unsigned int ptop;
|
unsigned int ptop;
|
||||||
MDB_cursor mn;
|
MDB_cursor mn;
|
||||||
|
|
||||||
@ -6380,13 +6380,12 @@ mdb_rebalance(MDB_cursor *mc)
|
|||||||
DPRINTF("found neighbor page %zu (%u keys, %.1f%% full)",
|
DPRINTF("found neighbor page %zu (%u keys, %.1f%% full)",
|
||||||
mn.mc_pg[mn.mc_top]->mp_pgno, NUMKEYS(mn.mc_pg[mn.mc_top]), (float)PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) / 10);
|
mn.mc_pg[mn.mc_top]->mp_pgno, NUMKEYS(mn.mc_pg[mn.mc_top]), (float)PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) / 10);
|
||||||
|
|
||||||
/* If the neighbor page is above threshold and has at least three
|
/* If the neighbor page is above threshold and has enough keys,
|
||||||
* keys, move one key from it. (A page must never have fewer than
|
* move one key from it. Otherwise we should try to merge them.
|
||||||
* 2 keys.)
|
* (A branch page must never have less than 2 keys.)
|
||||||
*
|
|
||||||
* Otherwise we should try to merge them.
|
|
||||||
*/
|
*/
|
||||||
if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= FILL_THRESHOLD && NUMKEYS(mn.mc_pg[mn.mc_top]) > 2)
|
minkeys = 1 + (IS_BRANCH(mn.mc_pg[mn.mc_top]));
|
||||||
|
if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= FILL_THRESHOLD && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys)
|
||||||
return mdb_node_move(&mn, mc);
|
return mdb_node_move(&mn, mc);
|
||||||
else {
|
else {
|
||||||
if (mc->mc_ki[ptop] == 0)
|
if (mc->mc_ki[ptop] == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user