Commit d593411a authored by follitude's avatar follitude Committed by siddontang

Enable pipelined write (#85)

parent 0f8c6816
......@@ -1921,6 +1921,11 @@ void crocksdb_options_set_bytes_per_sync(
opt->rep.bytes_per_sync = v;
}
void crocksdb_options_set_enable_pipelined_write(crocksdb_options_t *opt,
unsigned char v) {
opt->rep.enable_pipelined_write = v;
}
void crocksdb_options_set_allow_concurrent_memtable_write(crocksdb_options_t* opt,
unsigned char v) {
opt->rep.allow_concurrent_memtable_write = v;
......
......@@ -791,8 +791,11 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_use_adaptive_mutex(
extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_bytes_per_sync(
crocksdb_options_t*, uint64_t);
extern C_ROCKSDB_LIBRARY_API void
crocksdb_options_set_allow_concurrent_memtable_write(crocksdb_options_t*,
unsigned char);
crocksdb_options_set_enable_pipelined_write(crocksdb_options_t *,
unsigned char);
extern C_ROCKSDB_LIBRARY_API void
crocksdb_options_set_allow_concurrent_memtable_write(crocksdb_options_t *,
unsigned char);
extern C_ROCKSDB_LIBRARY_API void
crocksdb_options_set_enable_write_thread_adaptive_yield(crocksdb_options_t*,
unsigned char);
......
......@@ -282,6 +282,7 @@ extern "C" {
pub fn crocksdb_options_set_max_total_wal_size(options: *mut DBOptions, size: u64);
pub fn crocksdb_options_set_use_fsync(options: *mut DBOptions, v: c_int);
pub fn crocksdb_options_set_bytes_per_sync(options: *mut DBOptions, bytes: u64);
pub fn crocksdb_options_set_enable_pipelined_write(options: *mut DBOptions, v: bool);
pub fn crocksdb_options_set_allow_concurrent_memtable_write(options: *mut DBOptions, v: bool);
pub fn crocksdb_options_optimize_for_point_lookup(options: *mut DBOptions,
block_cache_size_mb: u64);
......
......@@ -926,6 +926,12 @@ impl Options {
unsafe { crocksdb_ffi::crocksdb_options_get_block_cache_usage(self.inner) as u64 }
}
pub fn enable_pipelined_write(&self, v: bool) {
unsafe {
crocksdb_ffi::crocksdb_options_set_enable_pipelined_write(self.inner, v);
}
}
pub fn allow_concurrent_memtable_write(&self, v: bool) {
unsafe {
crocksdb_ffi::crocksdb_options_set_allow_concurrent_memtable_write(self.inner, v);
......
......@@ -284,7 +284,8 @@ fn test_total_order_seek() {
let mut iter = db.iter();
// only iterate sst files and memtables that contain keys with the same prefix as b"k1"
// but it still can next/prev to the keys which is not prefixed as b"k1" with prefix_same_as_start
// but it still can next/prev to the keys which is not prefixed as b"k1" with
// prefix_same_as_start
iter.seek(SeekKey::Key(b"k1-0"));
let mut key_count = 0;
while iter.valid() {
......
......@@ -353,6 +353,18 @@ fn test_allow_concurrent_memtable_write() {
}
}
#[test]
fn test_enable_pipelined_write() {
let path = TempDir::new("_rust_rocksdb_enable_pipelined_write").expect("");
let mut opts = Options::new();
opts.create_if_missing(true);
opts.enable_pipelined_write(true);
let db = DB::open(opts, path.path().to_str().unwrap()).unwrap();
for i in 0..200 {
db.put(format!("k_{}", i).as_bytes(), b"v").unwrap();
}
}
#[test]
fn test_get_compression() {
let mut opts = Options::new();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment