Git Product home page Git Product logo

bitcask's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

museun sthagen

bitcask's Issues

[BUG] LruEntry uninitialized, which is invalid

  • bitcask master
  • cargo 1.50.0 (f04e7fab7 2021-02-04)
  • rustc 1.50.0 (cb75ad5db 2021-02-10)

run demo:

use bitcask;
use bytesize::ByteSize;

fn main() {
    let options = bitcask::Options {
        base_dir: std::path::PathBuf::from("./db1"),
        data_file_limit: ByteSize::mb(10).as_u64(),
    };

    let db = bitcask::new(options);
    if let Err(err_msg) = db {
        println!("{}", err_msg);
        std::process::exit(1);
    }
    let mut db = db.unwrap();

    for n in 0..1000 {
        let name = format!("Peter Nr. {}", n);
        let key = format!("name:{}", n);

        db.write(key.as_bytes(), name.as_bytes()).unwrap();
    }

    db.close().unwrap();
}

error report:

thread 'main' panicked at 'attempted to leave type `database::lru::LruEntry<u128, datafile::DataFile>` uninitialized, which is invalid', /home/xx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/cb75ad5db02783e8b0222fee363c5f63f7e2cf5b/library/core/src/panicking.rs:50:5
   3: core::mem::uninitialized
             at /home/xx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
   4: lru::LruCache<K,V,S>::construct
             at /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/lru-0.1.17/src/lib.rs:216:51
   5: lru::LruCache<K,V>::new
             at /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/lru-0.1.17/src/lib.rs:173:9
   6: bitcask::database::new
             at /home/xx/.cargo/git/checkouts/bitcask-ef3cb47bcd03a3bd/f218892/src/database.rs:75:27
   7: bitcask_rs::main
             at ./src/main.rs:10:14
   8: core::ops::function::FnOnce::call_once
             at /home/xx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.