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

Need an api GetDbSize #318

Closed
ketor opened this issue Nov 24, 2015 · 4 comments
Closed

Need an api GetDbSize #318

ketor opened this issue Nov 24, 2015 · 4 comments

Comments

@ketor
Copy link

ketor commented Nov 24, 2015

In some usercases, we need to get the totol file size of leveldb, and we need to get this information in our C++ programs directly.

But there is no function in db.h that provide total file size of all level files.
I would like to create a PR to fix this. Please help to review.

Thanks.

@ketor
Copy link
Author

ketor commented Nov 25, 2015

Fixed in PR: 319

@cmumford
Copy link
Contributor

cmumford commented Jan 4, 2016

We'd like to keep the leveldb API small. Any program can easily calculate the database size by stat'ing the files in the leveldb database directory - and do so more accurately than this function which omits logs, etc. leveldb::DB::GetApproximateSizes() is warranted given that it supports a key range, but this looks easy to implement within the client. Please let me know if I've overlooked anything.

@cmumford
Copy link
Contributor

cmumford commented May 3, 2019

Can you explain why leveldb::DB::GetApproximateSizes isn't sufficient? It measures the disk space of the key range (potentially all keys) and ignores files not in the db.

@cmumford
Copy link
Contributor

Closing because it is unclear why leveldb::DB::GetApproximateSizes and filesystem size aren't sufficient. Feel free to reopen if necessary.

maochongxin pushed a commit to maochongxin/leveldb that referenced this issue Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants