diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-07-10 07:11:01 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-07-10 07:11:01 -0600 |
commit | e903703e61efcfa8fcace7371c70912355e5576d (patch) | |
tree | 3061c1a474bcaf44f6108d2b67c91493f02eb750 /db_test.go | |
parent | Add 'Intro to BoltDB' link. (diff) | |
download | dedo-e903703e61efcfa8fcace7371c70912355e5576d.tar.gz dedo-e903703e61efcfa8fcace7371c70912355e5576d.tar.xz |
Fix Windows mmap sizing.
This commit fixes an issue on Windows where the database was doubling
when it was re-opened. This occurred because Windows has to truncate the
file to the mmap size and the mmap resizing code was doubling the size
whenever the DB size was at the next threshold. This has been changed so
that the DB size will double only when the DB size is above the next
threshold.
Diffstat (limited to 'db_test.go')
-rw-r--r-- | db_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -297,7 +297,8 @@ func TestDB_mmapSize(t *testing.T) { assert.Equal(t, db.mmapSize(0), minMmapSize) assert.Equal(t, db.mmapSize(16384), minMmapSize) assert.Equal(t, db.mmapSize(minMmapSize-1), minMmapSize) - assert.Equal(t, db.mmapSize(minMmapSize), minMmapSize*2) + assert.Equal(t, db.mmapSize(minMmapSize), minMmapSize) + assert.Equal(t, db.mmapSize(minMmapSize+1), (minMmapSize*2)+4096) assert.Equal(t, db.mmapSize(10000000), 20000768) assert.Equal(t, db.mmapSize((1<<30)-1), 2147483648) assert.Equal(t, db.mmapSize(1<<30), 1<<31) |