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
1742f182
Commit
1742f182
authored
Sep 21, 2017
by
Huachao Huang
Committed by
zhangjinpeng1987
Sep 21, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `read_amp_bytes_per_bit` option (#136)
parent
f3deb11b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
0 deletions
+49
-0
c.cc
librocksdb_sys/crocksdb/c.cc
+5
-0
c.h
librocksdb_sys/crocksdb/crocksdb/c.h
+3
-0
lib.rs
librocksdb_sys/src/lib.rs
+4
-0
rocksdb_options.rs
src/rocksdb_options.rs
+9
-0
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+28
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
1742f182
...
...
@@ -1563,6 +1563,11 @@ void crocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache(
options
->
rep
.
pin_l0_filter_and_index_blocks_in_cache
=
v
;
}
void
crocksdb_block_based_options_set_read_amp_bytes_per_bit
(
crocksdb_block_based_table_options_t
*
options
,
int
v
)
{
options
->
rep
.
read_amp_bytes_per_bit
=
v
;
}
void
crocksdb_options_set_block_based_table_factory
(
crocksdb_options_t
*
opt
,
crocksdb_block_based_table_options_t
*
table_options
)
{
...
...
librocksdb_sys/crocksdb/crocksdb/c.h
View file @
1742f182
...
...
@@ -594,6 +594,9 @@ crocksdb_block_based_options_set_cache_index_and_filter_blocks(
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache
(
crocksdb_block_based_table_options_t
*
,
unsigned
char
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_block_based_options_set_read_amp_bytes_per_bit
(
crocksdb_block_based_table_options_t
*
,
int
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_block_based_table_factory
(
crocksdb_options_t
*
opt
,
crocksdb_block_based_table_options_t
*
table_options
);
...
...
librocksdb_sys/src/lib.rs
View file @
1742f182
...
...
@@ -351,6 +351,10 @@ extern "C" {
block_options
:
*
mut
DBBlockBasedTableOptions
,
v
:
c_uchar
,
);
pub
fn
crocksdb_block_based_options_set_read_amp_bytes_per_bit
(
block_options
:
*
mut
DBBlockBasedTableOptions
,
v
:
c_int
,
);
pub
fn
crocksdb_options_increase_parallelism
(
options
:
*
mut
Options
,
threads
:
c_int
);
pub
fn
crocksdb_options_optimize_level_style_compaction
(
options
:
*
mut
Options
,
...
...
src/rocksdb_options.rs
View file @
1742f182
...
...
@@ -119,6 +119,15 @@ impl BlockBasedOptions {
v
as
u8
);
}
}
pub
fn
set_read_amp_bytes_per_bit
(
&
mut
self
,
v
:
u32
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_block_based_options_set_read_amp_bytes_per_bit
(
self
.inner
,
v
as
c_int
,
)
}
}
}
pub
struct
RateLimiter
{
...
...
tests/test_rocksdb_options.rs
View file @
1742f182
...
...
@@ -562,3 +562,31 @@ fn test_read_options() {
}
assert
!
(
key_count
==
3
);
}
#[test]
fn
test_block_based_options
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_block_based_options"
)
.expect
(
""
);
let
path_str
=
path
.path
()
.to_str
()
.unwrap
();
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
opts
.enable_statistics
();
opts
.set_stats_dump_period_sec
(
60
);
let
mut
bopts
=
BlockBasedOptions
::
new
();
bopts
.set_read_amp_bytes_per_bit
(
16
);
let
mut
cfopts
=
ColumnFamilyOptions
::
new
();
cfopts
.set_block_based_table_factory
(
&
bopts
);
let
db
=
DB
::
open_cf
(
opts
.clone
(),
path_str
,
vec!
[
"default"
],
vec!
[
cfopts
])
.unwrap
();
db
.put
(
b
"a"
,
b
"a"
)
.unwrap
();
db
.flush
(
true
)
.unwrap
();
db
.get
(
b
"a"
)
.unwrap
();
assert_ne!
(
opts
.get_statistics_ticker_count
(
TickerType
::
ReadAmpTotalReadBytes
),
0
);
assert_ne!
(
opts
.get_statistics_ticker_count
(
TickerType
::
ReadAmpEstimateUsefulBytes
),
0
);
}
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