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

How to get uncommitted data size? #948

Open
anidotnet opened this issue Feb 11, 2025 · 10 comments
Open

How to get uncommitted data size? #948

anidotnet opened this issue Feb 11, 2025 · 10 comments

Comments

@anidotnet
Copy link

I am planning to use redb as a backend store for a database application where lots of read write operations will happen concurrently. Instead of committing each write, I am looking for a way to get the uncommitted data size. If that value reaches a threshold, I'll do a commit and open a new write transaction.

Is there any way I can achieve this functionality in it's current form? If not, do you have any plan to add this?

@cberner
Copy link
Owner

cberner commented Feb 11, 2025 via email

@anidotnet
Copy link
Author

Any plan of exposing that in near future? It's a very crucial api for storage system.

@cberner
Copy link
Owner

cberner commented Feb 12, 2025

Not at the moment. I think the best approach is for you to make a fork, add the calls you need, and once it's all working I'm happy to take a look and see if it make sense to upstream

@anidotnet
Copy link
Author

I'll be happy to work on this. Could you please point me to where it is being tracked currently, as you mentioned earlier?

@cberner
Copy link
Owner

cberner commented Feb 12, 2025

allocated_since_commit: Mutex<HashSet<PageNumber>>,

@anidotnet
Copy link
Author

I guess these is how I'll get the actual uncommitted data size in bytes right?

pub(crate) fn page_size_bytes(&self, page_size: u32) -> u64 {

@cberner
Copy link
Owner

cberner commented Feb 12, 2025

yep

@anidotnet
Copy link
Author

I have raised the PR. Please review.

@cberner
Copy link
Owner

cberner commented Feb 14, 2025

Have you integrated it into your database? I'd like to see how it performs before merging this feature. In particular, that's going to be somewhat expensive to call, so I'm curious whether that really works for your use case

@anidotnet
Copy link
Author

Not yet. I'll do that in a couple of days and I'll let you know. In any case it will make my life easier. Currently for every modification (create, update, delete) I have to open a new transaction and commit it. For large data set it is taking ridiculous amount of time. Example, insertion of 10000 simple documents take 17 mins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants