-
Notifications
You must be signed in to change notification settings - Fork 59
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
Fix the Database implementation to address the documentation #144
Comments
After a small meeting with @dureuill, we thought about a possible solution to make it safe to use databases with heed and follow the limits of LMDB, even if it can be a little bit more restrictive. When we open an environment for the first time, we list all existing databases in the environment and open them all. Note that LMDB stores the database names in the unnamed database. The maxdbs parameter could be increased to at least have the number of databases (which are mixed with user keys) in the unnamed one. The documentation specifies that a moderate number is cheap, but a high number is expensive. This will fix issue 1. as we will use a read transaction to open and commit those databases to make them global to the process. It will then be possible for the user to However, if the database is not in the map, a read transaction will not call the The |
Powerdns in https://github.com/PowerDNS/pdns/blob/master/ext/lmdb-safe/lmdb-safe.cc#L202 Note: their api is transaction centered like redb one. |
So it means they are opening a short-lived transaction to open your database. What I don't like about this solution is that it tries to open a transaction without you knowing it. I would prefer we open all the databases when we open the environment or let the user open them (and be able to commit read txn) to make them globally available. I don't know what you think about what I wrote above. What do you think about it? |
I experimented a little bit on this playground. The basic idea is to add a lifetime to the |
The issue with the current heed library is that it is not ensuring either of those two points. Here is the documentation of
mdb_dbi_open
LMDB function:The text was updated successfully, but these errors were encountered: