Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Fix mmap resize calculation. #292

Merged
merged 4 commits into from
Jan 28, 2015
Merged

Conversation

benbjohnson
Copy link
Member

Overview

This pull request fixes an issue where the database would grow whenever it was opened. This was caused by a recent change that performed a truncation when the database grew. Now there are fixed growth sizes for the database (1MB, 2MB, 4MB, 8MB, etc) up to 1GB and then the database will grow by 1GB when it resizes.

See also: 6bb2585

Fixes: #291

/cc @kemist

This commit fixes an issue where the database would grow whenever it was opened. This was caused by
a recent change that performed a truncation when the database grew. Now there are fixed growth sizes
for the database (1MB, 2MB, 4MB, 8MB, etc) up to 1GB and then the database will grow by 1GB when it
resizes.

See also: 6bb2585
@benbjohnson
Copy link
Member Author

@tv42 Does this look correct to you? It was caused by the truncation-on-resize change I made recently.

@benbjohnson
Copy link
Member Author

@tv42 Good call. Fixed: 4e3fb8d

@tv42
Copy link
Contributor

tv42 commented Jan 28, 2015

Oh good catch, now it actually changes the size on the disk and not just the mmap view, and the old logic had a self-feeding spiral..

I added comments to benbjohnson@834b38e, summary: off-by-one, 32-bit worries, me nagging about errors.

This commit adds fixes suggested by @tv42 for the mmap step fix in 834b38e:

* Check max size before calculating the new the mmap size.
* Fix mmap step loop to go to 1GB instead of 512MB.
@benbjohnson
Copy link
Member Author

Awesome, thanks for looking through. I made the max step change and max size check change here: dacc187

@benbjohnson
Copy link
Member Author

OK, I spent 2 hours trying to get a 32-bit vagrant working but no ****ing luck. Here's my next attempt. I'm converting to int64 to prevent overflow and checking. Does this make sense: 338d8e7

@tv42
Copy link
Contributor

tv42 commented Jan 28, 2015

@benbjohnson Yeah can't see anything wrong with this one. Sometimes the simplest things are the hardest ones ;)

benbjohnson added a commit that referenced this pull request Jan 28, 2015
Fix mmap resize calculation.
@benbjohnson benbjohnson merged commit 681a5db into boltdb:master Jan 28, 2015
@benbjohnson benbjohnson deleted the fix-size branch January 28, 2015 21:58
@benbjohnson
Copy link
Member Author

Awesome, thanks! By the way, good luck on the Bolt talk at GoSF. Is it being recorded?

@tv42
Copy link
Contributor

tv42 commented Jan 28, 2015

@benbjohnson All I can say at this time is that I've seen earlier ones recorded, and sometimes they show up on youtube.

@xlab xlab mentioned this pull request Feb 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DB size doubling on OS X
2 participants