diff options
author | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-07-06 13:05:36 +0000 |
---|---|---|
committer | Martin Hedenfal <martinh@cvs.openbsd.org> | 2010-07-06 13:05:36 +0000 |
commit | 76ab5108bb08739427b2588125af4a521c7dc9a7 (patch) | |
tree | 6b0704c5cb647fa5ee4f1ae6379a0dce5200eb8a | |
parent | 8771e9b62472078ad77a8eb3dd3343497f0923d5 (diff) |
Adapt code to adhere to the comment (now that doesn't happen very often!).
When deciding how to rebalancing after delete (move or merge), the number
of keys is not important, as long as the source page doesn't get empty
after a move.
There is still a rare case where merging two quarter-full pages will not
fit in a whole page (due to prefix expansion) that needs to be fixed.
-rw-r--r-- | usr.sbin/ldapd/btree.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/ldapd/btree.c b/usr.sbin/ldapd/btree.c index 48e0473bd7b..6a5e29d27d7 100644 --- a/usr.sbin/ldapd/btree.c +++ b/usr.sbin/ldapd/btree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btree.c,v 1.24 2010/07/05 21:06:45 martinh Exp $ */ +/* $OpenBSD: btree.c,v 1.25 2010/07/06 13:05:35 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -2546,8 +2546,7 @@ btree_rebalance(struct btree *bt, struct mpage *mp) * possible, even if both are below threshold, as prefix expansion * might make keys larger. FIXME: detect this */ - if (PAGEFILL(bt, neighbor) >= FILL_THRESHOLD && - NUMKEYS(neighbor) >= NUMKEYS(mp) + 2) + if (PAGEFILL(bt, neighbor) >= FILL_THRESHOLD && NUMKEYS(neighbor) >= 2) return btree_move_node(bt, neighbor, si, mp, di); else { /* FIXME: if (has_enough_room()) */ if (mp->parent_index == 0) |