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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
4 deletions
+53
-4
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
+8
-4
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(
...
@@ -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
;
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
(
void
crocksdb_options_set_block_based_table_factory
(
crocksdb_options_t
*
opt
,
crocksdb_options_t
*
opt
,
crocksdb_block_based_table_options_t
*
table_options
)
{
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(
...
@@ -594,6 +594,9 @@ crocksdb_block_based_options_set_cache_index_and_filter_blocks(
extern
C_ROCKSDB_LIBRARY_API
void
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache
(
crocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache
(
crocksdb_block_based_table_options_t
*
,
unsigned
char
);
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
(
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
);
crocksdb_options_t
*
opt
,
crocksdb_block_based_table_options_t
*
table_options
);
...
...
librocksdb_sys/src/lib.rs
View file @
1742f182
...
@@ -138,8 +138,8 @@ pub enum CompactionPriority {
...
@@ -138,8 +138,8 @@ pub enum CompactionPriority {
#[derive(Copy,
Clone,
Debug)]
#[derive(Copy,
Clone,
Debug)]
#[repr(C)]
#[repr(C)]
pub
enum
DBStatisticsTickerType
{
pub
enum
DBStatisticsTickerType
{
BlockCacheMiss
=
0
,
// total block cache miss
BlockCacheMiss
=
0
,
// total block cache miss
BlockCacheHit
=
1
,
// total block cache hit
BlockCacheHit
=
1
,
// total block cache hit
BlockCacheAdd
=
2
,
BlockCacheAdd
=
2
,
BlockCacheAddFailures
=
3
,
BlockCacheAddFailures
=
3
,
BlockCacheIndexMiss
=
4
,
// times cache miss when accessing index block from block cache
BlockCacheIndexMiss
=
4
,
// times cache miss when accessing index block from block cache
...
@@ -156,9 +156,9 @@ pub enum DBStatisticsTickerType {
...
@@ -156,9 +156,9 @@ pub enum DBStatisticsTickerType {
BlockCacheDataHit
=
15
,
// times cache hit when accessing data block from block cache
BlockCacheDataHit
=
15
,
// times cache hit when accessing data block from block cache
BlockCacheDataAdd
=
16
,
BlockCacheDataAdd
=
16
,
BlockCacheDataBytesInsert
=
17
,
BlockCacheDataBytesInsert
=
17
,
BlockCacheByteRead
=
18
,
// bytes read from cache
BlockCacheByteRead
=
18
,
// bytes read from cache
BlockCacheByteWrite
=
19
,
// bytes written into cache
BlockCacheByteWrite
=
19
,
// bytes written into cache
BloomFilterUseful
=
20
,
// times bloom filter has avoided file reads
BloomFilterUseful
=
20
,
// times bloom filter has avoided file reads
MemtableHit
=
25
,
MemtableHit
=
25
,
MemtableMiss
=
26
,
MemtableMiss
=
26
,
GetHitL0
=
27
,
// Get() queries served by L0
GetHitL0
=
27
,
// Get() queries served by L0
...
@@ -351,6 +351,10 @@ extern "C" {
...
@@ -351,6 +351,10 @@ extern "C" {
block_options
:
*
mut
DBBlockBasedTableOptions
,
block_options
:
*
mut
DBBlockBasedTableOptions
,
v
:
c_uchar
,
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_increase_parallelism
(
options
:
*
mut
Options
,
threads
:
c_int
);
pub
fn
crocksdb_options_optimize_level_style_compaction
(
pub
fn
crocksdb_options_optimize_level_style_compaction
(
options
:
*
mut
Options
,
options
:
*
mut
Options
,
...
...
src/rocksdb_options.rs
View file @
1742f182
...
@@ -119,6 +119,15 @@ impl BlockBasedOptions {
...
@@ -119,6 +119,15 @@ impl BlockBasedOptions {
v
as
u8
);
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
{
pub
struct
RateLimiter
{
...
...
tests/test_rocksdb_options.rs
View file @
1742f182
...
@@ -562,3 +562,31 @@ fn test_read_options() {
...
@@ -562,3 +562,31 @@ fn test_read_options() {
}
}
assert
!
(
key_count
==
3
);
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