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

Add parallel LMDB database implementation #177

Merged
merged 28 commits into from
Mar 13, 2022
Merged

Add parallel LMDB database implementation #177

merged 28 commits into from
Mar 13, 2022

Conversation

casey
Copy link
Collaborator

@casey casey commented Mar 3, 2022

Refactor redb into a separate module, so we can add a parallel lmdb implementation. I don't think there's a strong reason to merge this as is, it's more of a starting point to add an lmdb database implementation. We don't need a trait, we just need to add an lmdb_database.rs source file containing Database and WriteTransaction with the same public functions.

@casey
Copy link
Collaborator Author

casey commented Mar 3, 2022

@terror I refactored things so it should be straightforward to add an lmdb database implementation, just turn on the lmdb feature and start implementing the todos in lmdb_database.rs

@casey
Copy link
Collaborator Author

casey commented Mar 4, 2022

I didn't see anything that jumped out at me as being clearly wrong. Do things like cargo run info work?

@casey
Copy link
Collaborator Author

casey commented Mar 6, 2022

@terror I figured it out! Lmdb (like redb) only allows one writer at a time. Calling Environment::create_db must count as a write, so if there's already a write transaction, Environment::create_db will block. The solution here is to create the databases before opening the write transaction.

@casey
Copy link
Collaborator Author

casey commented Mar 6, 2022

I added some more changes which make the empty_index test pass. Putting open_db after begin_ro_txn failed, and the reverse worked, which surprised me, since I assumed the problem was with doing this with write transactions.

@casey casey marked this pull request as ready for review March 12, 2022 22:49
@casey casey enabled auto-merge (squash) March 13, 2022 00:51
@casey casey merged commit 21515d3 into master Mar 13, 2022
@casey casey deleted the database-refactor branch March 13, 2022 00:52
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

Successfully merging this pull request may close these issues.

2 participants