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

Compact provides an API for regularly compressing the database. #679

Closed
wants to merge 1 commit into from

Conversation

glycerine
Copy link

Without regular compaction, the bolt database will grow
without bound on disk.

Fixes #674

@glycerine glycerine force-pushed the compact branch 4 times, most recently from 9f1ba7a to 25bdcef Compare May 1, 2017 16:24
@glycerine
Copy link
Author

@benbjohnson if you are too busy to review, is there somebody else you could suggest?

@vincent-petithory
Copy link
Contributor

vincent-petithory commented May 1, 2017 via email

@benbjohnson
Copy link
Member

@glycerine I'm hesitant to add this feature because I think it adds a lot of code and complexity for an issue that relatively few people have. Bolt doesn't typically work well with large values since it causes fragmentation.

This is also a feature that can largely be implemented outside of the core Bolt codebase. Why not make this a separate library that is layered on?

@glycerine
Copy link
Author

glycerine commented May 2, 2017

This allows bolt to work with large values, because it allows the fragmentation they produce to be addressed quite effectively. I run regularly with a single value, 3MB blob.

We must close the old database file and re-open the newly compacted file, so all places where the database is in use must be told to stop in the middle of wherever they are, and to start using a new database handle. This is difficult and awkward, if it is possible at all, from the outside library. By making the change-over inside the DB structure itself, everyone starts using the newly compacted database in unison at once. Nobody crashes because they are trying to read/write the old closed and deleted file.

Without regular compaction, the bolt database will grow
without bound on disk.

Fixes boltdb#674
@benbjohnson
Copy link
Member

@glycerine I thought it over for day and I decided that it's too much of an edge case feature to warrant the large amount of code required. I think the best case forward would be to leave it as a branch on your fork and we can add a link in the README for anyone who needs the functionality. It's easy enough to vendor in a different repo in a project and the bolt project doesn't change often enough that the fork would get out of date.

@benbjohnson benbjohnson closed this May 3, 2017
@adamluzsi
Copy link

Still the concept is awesome and as a package that wraps boltdb connection around and add this feature is a promising idea.

@glycerine
Copy link
Author

@benbjohnson Thanks for thinking about it. I guess I just disagree about the importance of being able to store large values. But I understand that you want to keep the codebase small, and that is a valuable attribute.

@adamluzsi I don't see how to make a wrapper, since we need to add a check at the end of every transaction commit. If there was a hook for all transactions (not just on a tx-by-tx basis), then a wrapper might be doable.

I've made a fork to support big values, https://github.com/bigboltdb/bolt.

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.

None yet

4 participants