diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2016-01-11 14:47:01 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2016-01-11 14:47:01 -0700 |
commit | 694a82a9595845d376dd19ff5c24cab78801204b (patch) | |
tree | 19c30005f6e3c46c78eb582e9f28f8af81d24d10 /db_test.go | |
parent | Merge pull request #479 from azazeal/master (diff) | |
parent | do not grow dbsize agressively (diff) | |
download | dedo-694a82a9595845d376dd19ff5c24cab78801204b.tar.gz dedo-694a82a9595845d376dd19ff5c24cab78801204b.tar.xz |
Merge branch 'grow' of https://github.com/xiang90/bolt into xiang90-grow
Diffstat (limited to 'db_test.go')
-rw-r--r-- | db_test.go | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -229,6 +229,8 @@ func TestOpen_Size(t *testing.T) { path := db.Path() defer db.MustClose() + pagesize := db.Info().PageSize + // Insert until we get above the minimum 4MB size. if err := db.Update(func(tx *bolt.Tx) error { b, _ := tx.CreateBucketIfNotExists([]byte("data")) @@ -273,7 +275,8 @@ func TestOpen_Size(t *testing.T) { } // Compare the original size with the new size. - if sz != newSz { + // db size might increase by a few page sizes due to the new small update. + if sz < newSz-5*int64(pagesize) { t.Fatalf("unexpected file growth: %d => %d", sz, newSz) } } @@ -290,6 +293,8 @@ func TestOpen_Size_Large(t *testing.T) { path := db.Path() defer db.MustClose() + pagesize := db.Info().PageSize + // Insert until we get above the minimum 4MB size. var index uint64 for i := 0; i < 10000; i++ { @@ -338,7 +343,8 @@ func TestOpen_Size_Large(t *testing.T) { } // Compare the original size with the new size. - if sz != newSz { + // db size might increase by a few page sizes due to the new small update. + if sz < newSz-5*int64(pagesize) { t.Fatalf("unexpected file growth: %d => %d", sz, newSz) } } |