aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/bench.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-07-24 10:36:09 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-07-24 10:36:09 -0600
commitc3400efefdf9733e98cb125d00a0c0721a2db51e (patch)
tree6ba412db0873b653e98d1db414293d413dd2f558 /cmd/bolt/bench.go
parentMerge pull request #228 from benbjohnson/fix-large-append (diff)
downloaddedo-c3400efefdf9733e98cb125d00a0c0721a2db51e.tar.gz
dedo-c3400efefdf9733e98cb125d00a0c0721a2db51e.tar.xz
Change fill percent to be per-bucket.
This commit moves the DB.FillPercent field to Bucket.FillPercent. This allows the fill percentage to be specified per-bucket, per-tx. This value is not persisted and should be set whenever using it.
Diffstat (limited to 'cmd/bolt/bench.go')
-rw-r--r--cmd/bolt/bench.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/bolt/bench.go b/cmd/bolt/bench.go
index a3aa9b8..b275542 100644
--- a/cmd/bolt/bench.go
+++ b/cmd/bolt/bench.go
@@ -47,7 +47,6 @@ func Bench(options *BenchOptions) {
return
}
db.NoSync = options.NoSync
- db.FillPercent = options.FillPercent
defer db.Close()
// Enable streaming stats.
@@ -140,6 +139,7 @@ func benchWriteWithSource(db *bolt.DB, options *BenchOptions, results *BenchResu
for i := 0; i < options.Iterations; i += options.BatchSize {
err := db.Update(func(tx *bolt.Tx) error {
b, _ := tx.CreateBucketIfNotExists(benchBucketName)
+ b.FillPercent = options.FillPercent
for j := 0; j < options.BatchSize; j++ {
var key = make([]byte, options.KeySize)
@@ -165,10 +165,12 @@ func benchWriteNestedWithSource(db *bolt.DB, options *BenchOptions, results *Ben
for i := 0; i < options.Iterations; i += options.BatchSize {
err := db.Update(func(tx *bolt.Tx) error {
top, _ := tx.CreateBucketIfNotExists(benchBucketName)
+ top.FillPercent = options.FillPercent
var name = make([]byte, options.KeySize)
binary.BigEndian.PutUint32(name, keySource())
b, _ := top.CreateBucketIfNotExists(name)
+ b.FillPercent = options.FillPercent
for j := 0; j < options.BatchSize; j++ {
var key = make([]byte, options.KeySize)