Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
d593411a
Commit
d593411a
authored
Jul 08, 2017
by
follitude
Committed by
siddontang
Jul 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable pipelined write (#85)
parent
0f8c6816
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
3 deletions
+31
-3
c.cc
librocksdb_sys/crocksdb/c.cc
+5
-0
c.h
librocksdb_sys/crocksdb/rocksdb/c.h
+5
-2
lib.rs
librocksdb_sys/src/lib.rs
+1
-0
rocksdb_options.rs
src/rocksdb_options.rs
+6
-0
test_iterator.rs
tests/test_iterator.rs
+2
-1
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+12
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
d593411a
...
@@ -1921,6 +1921,11 @@ void crocksdb_options_set_bytes_per_sync(
...
@@ -1921,6 +1921,11 @@ void crocksdb_options_set_bytes_per_sync(
opt
->
rep
.
bytes_per_sync
=
v
;
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
,
void
crocksdb_options_set_allow_concurrent_memtable_write
(
crocksdb_options_t
*
opt
,
unsigned
char
v
)
{
unsigned
char
v
)
{
opt
->
rep
.
allow_concurrent_memtable_write
=
v
;
opt
->
rep
.
allow_concurrent_memtable_write
=
v
;
...
...
librocksdb_sys/crocksdb/rocksdb/c.h
View file @
d593411a
...
@@ -791,8 +791,11 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_use_adaptive_mutex(
...
@@ -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
(
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_bytes_per_sync
(
crocksdb_options_t
*
,
uint64_t
);
crocksdb_options_t
*
,
uint64_t
);
extern
C_ROCKSDB_LIBRARY_API
void
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_allow_concurrent_memtable_write
(
crocksdb_options_t
*
,
crocksdb_options_set_enable_pipelined_write
(
crocksdb_options_t
*
,
unsigned
char
);
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
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_enable_write_thread_adaptive_yield
(
crocksdb_options_t
*
,
crocksdb_options_set_enable_write_thread_adaptive_yield
(
crocksdb_options_t
*
,
unsigned
char
);
unsigned
char
);
...
...
librocksdb_sys/src/lib.rs
View file @
d593411a
...
@@ -282,6 +282,7 @@ extern "C" {
...
@@ -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_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_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_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_set_allow_concurrent_memtable_write
(
options
:
*
mut
DBOptions
,
v
:
bool
);
pub
fn
crocksdb_options_optimize_for_point_lookup
(
options
:
*
mut
DBOptions
,
pub
fn
crocksdb_options_optimize_for_point_lookup
(
options
:
*
mut
DBOptions
,
block_cache_size_mb
:
u64
);
block_cache_size_mb
:
u64
);
...
...
src/rocksdb_options.rs
View file @
d593411a
...
@@ -926,6 +926,12 @@ impl Options {
...
@@ -926,6 +926,12 @@ impl Options {
unsafe
{
crocksdb_ffi
::
crocksdb_options_get_block_cache_usage
(
self
.inner
)
as
u64
}
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
)
{
pub
fn
allow_concurrent_memtable_write
(
&
self
,
v
:
bool
)
{
unsafe
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_allow_concurrent_memtable_write
(
self
.inner
,
v
);
crocksdb_ffi
::
crocksdb_options_set_allow_concurrent_memtable_write
(
self
.inner
,
v
);
...
...
tests/test_iterator.rs
View file @
d593411a
...
@@ -284,7 +284,8 @@ fn test_total_order_seek() {
...
@@ -284,7 +284,8 @@ fn test_total_order_seek() {
let
mut
iter
=
db
.iter
();
let
mut
iter
=
db
.iter
();
// only iterate sst files and memtables that contain keys with the same prefix as b"k1"
// 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"
));
iter
.seek
(
SeekKey
::
Key
(
b
"k1-0"
));
let
mut
key_count
=
0
;
let
mut
key_count
=
0
;
while
iter
.valid
()
{
while
iter
.valid
()
{
...
...
tests/test_rocksdb_options.rs
View file @
d593411a
...
@@ -353,6 +353,18 @@ fn test_allow_concurrent_memtable_write() {
...
@@ -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]
#[test]
fn
test_get_compression
()
{
fn
test_get_compression
()
{
let
mut
opts
=
Options
::
new
();
let
mut
opts
=
Options
::
new
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment