-
Notifications
You must be signed in to change notification settings - Fork 60
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
Unable to create database when MDB_WRITEMAP is set #95
Comments
Hey, I am not sure why as I only call the LMDB methods under the hood. |
Will try to reproduce using only the C library. |
Wasn't able to reproduce using the C library. I think the issue is with nested write transactions. The following patch fixes the issue: diff --git a/heed/src/env.rs b/heed/src/env.rs
index a8305c5..d126cc9 100644
--- a/heed/src/env.rs
+++ b/heed/src/env.rs
@@ -318,23 +318,20 @@ impl Env {
KC: 'static,
DC: 'static,
{
- let mut parent_wtxn = self.write_txn()?;
- let db = self.create_database_with_txn(name, &mut parent_wtxn)?;
- parent_wtxn.commit()?;
+ let db = self.create_database_with_txn(name)?;
Ok(db)
}
pub fn create_database_with_txn<KC, DC>(
&self,
name: Option<&str>,
- parent_wtxn: &mut RwTxn,
) -> Result<Database<KC, DC>>
where
KC: 'static,
DC: 'static,
{
let types = (TypeId::of::<KC>(), TypeId::of::<DC>());
- self.raw_create_database(name, types, parent_wtxn)
+ self.raw_create_database(name, types)
.map(|db| Database::new(self.env_mut_ptr() as _, db))
}
@@ -342,9 +339,8 @@ impl Env {
&self,
name: Option<&str>,
types: (TypeId, TypeId),
- parent_wtxn: &mut RwTxn,
) -> Result<u32> {
- let wtxn = self.nested_write_txn(parent_wtxn)?;
+ let wtxn = self.write_txn()?;
let mut dbi = 0;
let name = name.map(|n| CString::new(n).unwrap());
|
@timokoesters that's indeed a duplicate of the the issue you opened recently but I have no plan to fix it. Maybe you could submit a PR, it you do please make sur to start from the right branch (v0.12). It depends on the version you were using you could also start from v0.11. |
Closed by #128. |
To reproduce:
fails with:
Works fine if
env_builder.flag(Flags::MdbWriteMap);
is commented out.The text was updated successfully, but these errors were encountered: