Skip to content

Commit

Permalink
Adjust rebalance threshold with Bucket.FillPercent
Browse files Browse the repository at this point in the history
Signed-off-by: Cenk Alti <[email protected]>
  • Loading branch information
cenkalti committed May 30, 2023
1 parent 053fd18 commit 03e5cc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 03e5cc7

Please sign in to comment.