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

Potential issue with DUP_SORT #58

Open
eranrund opened this issue Mar 27, 2020 · 0 comments
Open

Potential issue with DUP_SORT #58

eranrund opened this issue Mar 27, 2020 · 0 comments

Comments

@eranrund
Copy link

Hey!

I might be missing something here, but from what it looks like, DUP_SORT is not behaving as expected.

I have the following test code:

use lmdb::{Cursor, Database, DatabaseFlags, Environment, RwTransaction, Transaction, WriteFlags};
use std::sync::Arc;
use tempdir::TempDir;

fn main() {
    let db_tmp = TempDir::new("test").unwrap().into_path();
    let db_path = db_tmp.to_str().unwrap();

    let env = Arc::new(
        Environment::new()
            .set_max_dbs(10)
            .set_map_size(10000000)
            .open(db_path.as_ref())
            .unwrap(),
    );

    let db = env
        .create_db(Some("db_name"), DatabaseFlags::DUP_SORT)
        .unwrap();

    let key = vec![3u8; 32];
    let val = vec![4u8; 32];

    {
        let mut db_txn = env.begin_rw_txn().unwrap();

        db_txn.put(db, &key, &val, WriteFlags::empty()).unwrap();

        db_txn.commit().unwrap();
    }

    {
        let mut db_txn = env.begin_rw_txn().unwrap();

        db_txn.del(db, &key, Some(&val)).unwrap();

        db_txn.commit().unwrap();
    }
}

The code panics at db_txn.del(db, &key, Some(&val)).unwrap(); with Err value: NotFound'`. Is this expected to work?

Thank you!

stuhood pushed a commit to pantsbuild/lmdb-rs that referenced this issue Jan 25, 2022
Run lmdb tests alongside `cargo test`
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

1 participant