Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Config option to limit maximum size of database file #928

Open
mattsains opened this issue Mar 17, 2025 · 1 comment · May be fixed by #929
Open

Feature request: Config option to limit maximum size of database file #928

mattsains opened this issue Mar 17, 2025 · 1 comment · May be fixed by #929

Comments

@mattsains
Copy link

Hello,

In some cases, bbolt is used by applications like opentelemetry-collector as a kind of persistent queue or cache system. It would be nice if it were possible to configure the maximum size of a bbolt database and return an error when the database needs to grow beyond this size.

The way I see this working is adding a max size field to the Options object, and then checking this maximum size against the requested size sz in the grow() function. If the size requested is larger than the maximum size, return an error similar to what happens when the Truncate call fails. However, it would be good to export this error so that it can be checked by callers to Update/Batch.

I'm happy to do the work but wanted to find out if this is desirable before submitting a PR

@mattsains
Copy link
Author

mattsains commented Mar 17, 2025

An alternative approach might be to expose the size of the db file in DB.Stats and have the caller check this before and after a write operation. Is is already exposed as DB.Stats().TxStats.GetPageAlloc()?

mattsains added a commit to mattsains/bbolt that referenced this issue Mar 24, 2025
@mattsains mattsains linked a pull request Mar 24, 2025 that will close this issue
mattsains added a commit to mattsains/bbolt that referenced this issue Mar 24, 2025
closes etcd-io#928

Signed-off-by: Matthew Sainsbury <matthew@sainsbury.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant