rust-lib-project / calibur Goto Github PK
View Code? Open in Web Editor NEWA port for rocksdb
License: Apache License 2.0
A port for rocksdb
License: Apache License 2.0
Every time we create a iterator we will acquire lock for version_set and it may be block by some other background thread.
So we need a thread-local snapshot ptr or an atomic ptr to avoid acquire mutex.
part of #4
The feature may be too large so I think it's better to split it into multiple tasks with different algorithm
To save disk space, RocksDB will compress the data by block by some popular algorithm such as LZ4 and ZSTD. To make code simple to understand, I think we only need to implement these two algorithm at first, to be compatible with current data formats of RocksDB. Of course, maybe we can find a better file format and a better compression algorithm in the future, but it is not for now.
Run simple example in PR #6: cargo run --example simple_example
, and program will failed in Engine::open
. The detail errno is EINVAL.
According to man 2 read
:
EINVAL fd is attached to an object which is unsuitable for reading; or the file was opened with the O_DIRECT flag, and either the address specified in buf, the value specified in count, or the file offset is not suitably aligned.
I noticed that get_current_manifest_path
will invokes FileSystem::read_file_content
, which eventually invoke AsyncRandomAccessFile::open
, and O_DIRECT
is added to open
, but there doesn't seem to be any alignment in read_file_content
.
RocksDB can create bloom-filter with prefix of keys. And when user want to seek some key, RocksDB can tell whether this key is found when the prefix of which seek key match the first key in DB.
RocksDB can give a bound to iterator so that iterator would not skip too many tombstone.
Now we will sort all files every level by priority and only take the higher score level. But it may be some case that the highest score level is during compact job and we can not pick any file. So that we need to skip the highest level to find another level to compact
Here we only use one thread to compact file from L0 to base level. But for level style compaction, the compaction job which will merge multiple files from L0 to base level, must run with only one job. If we only use one thread, this job will be slowly. So RocksDB will split this job to multiple range and every thread run one range to speed up.
In order to complete the prototype of the database as quickly as possible, I did not design the cache before, which would cause all requests to directly access the disk data. I hope a rocksdb-like block-cache but if anyone else has a better opinion, I'll gladly accept it.
table_factory
and send it to every TableReader
.In this issue, #7, rocksdb-rs will return error because we do not give an align block size.
We may need to give a align read size to file for direct io and cache the data in reader itself
As a LSM Tree engine, all the data will be persisted in write-ahead-log files by an append-IO, and then they will be applied to structure in memory, which we called memtable. And when the data in memtable are flushed on disk, we could remove the wal files to release disk space.
what‘s the difference between rust-rocksdb
To quickly finish engine, we open all file when they are generate or open all files when open DB.
But if most of files will never be access because they are cold data, it is not a good idea to store the filter-block in memory.
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.