fullstop000 / wickdb Goto Github PK
View Code? Open in Web Editor NEWPure Rust LSM-tree based embedded storage engine
License: Apache License 2.0
Pure Rust LSM-tree based embedded storage engine
License: Apache License 2.0
The implementation of Slice
is unsafe and it requires extra concerns from users.
Lines 181 to 185 in 8a87a80
As block_iter.key()
returns an owned Slice
which represents the key
field in block_iter
, UB occurs after block_iter
is dropped.
For some read-only files, the mmap
can be used to improve the reading performance in read-only situation a lot. For example, when doing major compaction, reading the input SSTables by mmap
may be more sufficient than just calling read()
.
In origin leveldb
fs layer env
, PosixMmapReadableFile
is introduced for such cases.
Add benchmark for components below :
Recommended using https://github.com/bheisler/criterion.rs
Temporarily, it's marked as ignored
running 1 test
test sstable::tests::test_randomized_key ... FAILED
failures:
---- sstable::tests::test_randomized_key stdout ----
thread 'sstable::tests::test_randomized_key' panicked at 'called `Option::unwrap()` on a `None` value', src/db/iterator.rs:387:43
It is missing this important feature
Currently, we use a simple file to store all log messages:
Lines 54 to 58 in 15c37cc
This could be a bad design as the log messages growing. Adding a file rotation by implementing a slog Drain
might be a good solution.
failures:
---- sstable::table::tests::test_build_empty_table stdout ----
thread 'sstable::table::tests::test_build_empty_table' panicked at 'assertion failed: table.meta_block_handle.is_some()', src/sstable/table.rs:665:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook
at src/libstd/panicking.rs:208
4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
at src/libstd/panicking.rs:474
5: std::sync::once::Once::is_completed
at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libstd/panicking.rs:408
6: wickdb::sstable::table::tests::test_build_empty_table
at src/sstable/table.rs:665
7: wickdb::sstable::table::tests::test_build_empty_table::{{closure}}
at src/sstable/table.rs:655
8: core::ops::function::FnOnce::call_once
at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libcore/ops/function.rs:231
9: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/liballoc/boxed.rs:704
10: panic_unwind::dwarf::eh::read_encoded_pointer
at src/libpanic_unwind/lib.rs:85
11: test::run_test::run_test_inner::{{closure}}
at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libstd/panicking.rs:272
at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c/src/libstd/panic.rs:394
at src/libtest/lib.rs:1468
Something wrong happens in table iterator
If compact_mem_table
fails, the immutable memtable will be still there. And we re-schedule compaction after a compaction which means compact_mem_table
will be called infinitely. To fix this, we can introduce a backoff to prevent the infinite compaction loop.
If compaction fails hits the backoff limit, prevent all writing requests to the wickdb could be a good choice.
In most instances, codes perform faster when using Generic than Trait Object.
We can replace some trait objects by Generic (not all of them) to benefit from inline function in compile time.
Currently, the WriteBatch
follows the original implementation of leveldb, which is a Vec<u8>
with encoded entries. When we call put
, the entry will be encoded into variant length based encoded bytes, fill the bytes into a WriteBatch
and then be inserted into MemTable
, However, when inserting the batch into MemTable
, it needs to be decoded into entires first.
For a more efficient inserting style, we might just let WriteBatch
hold unencoded entries, and deliver them to the MemTable
without any serde.
In the origin version of leveldb, the write path is like below:
write
write + write
+ | write +
| | + |
| | | |
| | | |
+---v-------v-----v-----v---+
| |
| Mutex<queue> |
| |
+-------------+-------------+
|
|
| group batch
| <single thread>
|
v
+--------+--------+
| |
| Memtable |
| |
+-----------------+
Writing batches concurrently will result in a single thread ingestion into memtable and then notify all the relate blocked write request threads.
Maybe we can support concurrently inserting batches into memtable , which should improve the write performance a lot.
This feature includes following tasks:
https://travis-ci.org/Fullstop000/wickdb/jobs/588278442
CI failed in macOS because of the lack of lib six
for lldb
:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Resources/Python/lldb/__init__.py", line 98, in <module>
import six
ImportError: No module named six
Traceback (most recent call last):
File "<string>", line 1, in <module>
And it's wired that sstable::tests::test_simple_empty_key
hangs when running kcov
but works fine in other places.
Relative issue: rust-lang/rust#38380
Current Iterator trait returns owned Slice from key()
and value()
, which is really unsafe.
Use lifetime bounded &'a [u8]
instead.
This is part of #24
Increase the coverage of test cases over 90%.
See https://codecov.io/gh/Fullstop000/wickdb
Most essential parts:
MemStorage
https://travis-ci.org/Fullstop000/wickdb/jobs/602617170
Done. Your build exited with 0.
CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.15/Modules/FindZLIB.cmake:115 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/CMakeLists.txt:8 (find_package)
/c/Users/travis/.travis/functions: line 109: make: command not found
/c/Users/travis/.travis/functions: line 109: make: command not found
/c/Users/travis/.travis/functions: line 109: ./kcov-build/usr/local/bin/kcov: No such file or directory
bash: /dev/fd/63: No such file or directory
Current Iterator
trait just returns Slice
in key()
and value()
Lines 59 to 65 in 6029534
This can limit the usage of Iterator
s. We might want a non-slice key or value.
Consider using an advanced trait with associated type instead:
pub trait Iterator {
type Key;
type Value;
fn key(&self) -> Self::Key;
fn value(&self) -> Self::Value;
}
Block #49
如题
Relative link RFC/0344.
Clearly, we just need to rename set_
methods in normal structs.
Add an individual module for benchmark through customized YCSB workload.
Refer to https://github.com/cockroachdb/pebble/blob/master/cmd/pebble/ycsb.go
Use slog as the project logging
我使用win10的操作系统,rust-version
是1.3.1,cargo test
时候,报出如下错误
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> src\lib.rs:50:9
|
34 | mod compaction;
| --------------- not an extern crate passed with `--extern`
...
50 | pub use compaction::ManualCompaction;
| ^^^^^^^^^^
|
note: this import refers to the module defined here
--> src\lib.rs:34:1
|
34 | mod compaction;
| ^^^^^^^^^^^^^^^
error[E0658]: imports can only refer to extern crate names passed with `--extern` on stable channel (see issue #53130)
--> src\lib.rs:51:9
|
35 | pub mod db;
| ----------- not an extern crate passed with `--extern`
...
51 | pub use db::{WickDB, DB};
| ^^
|
note: this import refers to the module defined here
--> src\lib.rs:35:1
|
35 | pub mod db;
| ^^^^^^^^^^^
There are several steps in the CI that could produce a binary like wickdb-***
under target/debug
. And kcov
will try to generate a Codecov report for every binary existed due to it has no idea which is the latest, which results in very long processing time (it re-run all the tests with every binary every time)
Get result from cargo test
:
test db::filename::tests::test_generate_filename ... ok
test db::format::tests::test_pack_seq_and_type ... ok
test db::filename::tests::test_parse_filename ... ok
test db::format::tests::test_internal_key_encode_decode ... ok
wickdb-4ab306f68f44e64d(32405,0x700008904000) malloc: *** error for object 0x11147a038: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
test mem::arena::tests::test_alloc_nodes ... ok
error: process didn't exit successfully: `/Users/fullstop000/rust/wickdb/target/debug/deps/wickdb-4ab306f68f44e64d` (signal: 6, SIGABRT: process abort signal)
But it is confused that all the tests are green if you use cargo test <mod name>
for every mod.
And this only happens in mac OS.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.