Adjust rebalance threshold with Bucket.FillPercent

Signed-off-by: Cenk Alti <cenkalti@gmail.com>
pull/518/head
Cenk Alti 2023-05-30 10:04:05 -04:00
parent 053fd189c8
commit 03e5cc7958
No known key found for this signature in database
GPG Key ID: 30BB97EF64A82993
1 changed files with 2 additions and 2 deletions

View File

@ -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
}