diff options
| author | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-15 14:04:57 -0600 |
|---|---|---|
| committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-15 14:04:57 -0600 |
| commit | a1873dd6f65654d463455ae2d381c35c12f71f51 (patch) | |
| tree | 4b5b5cff16a08bbeebe0e7c2909eaf003cf90ec2 /node.go | |
| parent | Merge pull request #165 from benbjohnson/strict-mode (diff) | |
| download | dedo-a1873dd6f65654d463455ae2d381c35c12f71f51.tar.gz dedo-a1873dd6f65654d463455ae2d381c35c12f71f51.tar.xz | |
Add option to adjust fill percentage.
This commit adds the ability to adjust the fill percentage for splitting nodes. This
works by setting a threshold that is a percentage of a total page size. When that
threshold is crossed during a split then a new node is created.
This is primarily beneficial for append-only workloads.
Fixes #163.
Diffstat (limited to '')
| -rw-r--r-- | node.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -215,8 +215,14 @@ func (n *node) split(pageSize int) []*node { return nodes } - // Set fill threshold to 50%. - threshold := pageSize / 2 + // Determine the threshold before starting a new node. + var fillPercent = n.bucket.tx.db.FillPercent + if fillPercent < minFillPercent { + fillPercent = minFillPercent + } else if fillPercent > maxFillPercent { + fillPercent = maxFillPercent + } + threshold := int(float64(pageSize) * fillPercent) // Group into smaller pages and target a given fill size. size := pageHeaderSize |
