From 03e5cc7958c042a1fe88eb0acd0e0e814c08e34b Mon Sep 17 00:00:00 2001 From: Cenk Alti Date: Tue, 30 May 2023 10:04:05 -0400 Subject: [PATCH] Adjust rebalance threshold with Bucket.FillPercent Signed-off-by: Cenk Alti --- node.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node.go b/node.go index 2f4d46baf..fe67c3c89 100644 --- a/node.go +++ b/node.go @@ -371,8 +371,8 @@ func (n *node) rebalance() { // Update statistics. n.bucket.tx.stats.IncRebalance(1) - // Ignore if node is above threshold (25%) and has enough keys. - var threshold = n.bucket.tx.db.pageSize / 4 + // Ignore if node is above threshold (25% when FillPercent is set to DefaultFillPercent) and has enough keys. + var threshold = int(float64(n.bucket.tx.db.pageSize)*n.bucket.FillPercent) / 2 if n.size() > threshold && len(n.inodes) > n.minKeys() { return }