From c3400efefdf9733e98cb125d00a0c0721a2db51e Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 24 Jul 2014 10:36:09 -0600 Subject: 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. --- cmd/bolt/bench.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cmd/bolt/bench.go') 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) -- cgit v1.2.3