aboutsummaryrefslogtreecommitdiff
path: root/bucket_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-05-19 12:08:33 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-05-19 12:08:33 -0600
commit782ead0dbf3095d0e843c2036bf40cc8ecd9b4d1 (patch)
tree19babfefc617c7f82bc5dcfc287b3f4809a6623a /bucket_test.go
parentMerge pull request #166 from benbjohnson/fill-percent (diff)
downloaddedo-782ead0dbf3095d0e843c2036bf40cc8ecd9b4d1.tar.gz
dedo-782ead0dbf3095d0e843c2036bf40cc8ecd9b4d1.tar.xz
Fix freelist allocation direction.
This commit fixes the freelist so that it frees from the beginning of the data file instead of the end. It also adds a fast path for pages which can be allocated from the first free pages and it includes read transaction stats.
Diffstat (limited to 'bucket_test.go')
-rw-r--r--bucket_test.go25
1 files changed, 8 insertions, 17 deletions
diff --git a/bucket_test.go b/bucket_test.go
index f6bd13f..16172a5 100644
--- a/bucket_test.go
+++ b/bucket_test.go
@@ -899,30 +899,21 @@ func TestBucket_Delete_Quick(t *testing.T) {
assert.NoError(t, err)
// Remove items one at a time and check consistency.
- for i, item := range items {
+ for _, item := range items {
err := db.Update(func(tx *Tx) error {
return tx.Bucket([]byte("widgets")).Delete(item.Key)
})
assert.NoError(t, err)
+ }
- // Anything before our deletion index should be nil.
- db.View(func(tx *Tx) error {
- b := tx.Bucket([]byte("widgets"))
- for j, exp := range items {
- value := b.Get(exp.Key)
- if j > i {
- if !assert.Equal(t, exp.Value, value) {
- t.FailNow()
- }
- } else {
- if !assert.Nil(t, value) {
- t.FailNow()
- }
- }
- }
+ // Anything before our deletion index should be nil.
+ db.View(func(tx *Tx) error {
+ tx.Bucket([]byte("widgets")).ForEach(func(k, v []byte) error {
+ t.Fatalf("bucket should be empty; found: %06x", trunc(k, 3))
return nil
})
- }
+ return nil
+ })
})
return true
}