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
5e3bfdc7
Unverified
Commit
5e3bfdc7
authored
Dec 05, 2017
by
Huachao Huang
Committed by
GitHub
Dec 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide interface to disable statistics and block cache (#171)
parent
de425687
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
10 deletions
+21
-10
c.cc
librocksdb_sys/crocksdb/c.cc
+6
-2
c.h
librocksdb_sys/crocksdb/crocksdb/c.h
+1
-1
lib.rs
librocksdb_sys/src/lib.rs
+1
-1
main.rs
src/main.rs
+2
-1
rocksdb_options.rs
src/rocksdb_options.rs
+8
-2
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+2
-2
test_statistics.rs
tests/test_statistics.rs
+1
-1
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
5e3bfdc7
...
...
@@ -1957,8 +1957,12 @@ void crocksdb_options_set_max_bytes_for_level_multiplier_additional(
}
}
void
crocksdb_options_enable_statistics
(
crocksdb_options_t
*
opt
)
{
opt
->
rep
.
statistics
=
rocksdb
::
CreateDBStatistics
();
void
crocksdb_options_enable_statistics
(
crocksdb_options_t
*
opt
,
unsigned
char
v
)
{
if
(
v
)
{
opt
->
rep
.
statistics
=
rocksdb
::
CreateDBStatistics
();
}
else
{
opt
->
rep
.
statistics
=
nullptr
;
}
}
void
crocksdb_options_reset_statistics
(
crocksdb_options_t
*
opt
)
{
...
...
librocksdb_sys/crocksdb/crocksdb/c.h
View file @
5e3bfdc7
...
...
@@ -788,7 +788,7 @@ extern C_ROCKSDB_LIBRARY_API void
crocksdb_options_set_max_bytes_for_level_multiplier_additional
(
crocksdb_options_t
*
,
int
*
level_values
,
size_t
num_levels
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_enable_statistics
(
crocksdb_options_t
*
);
crocksdb_options_t
*
,
unsigned
char
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_reset_statistics
(
crocksdb_options_t
*
);
...
...
librocksdb_sys/src/lib.rs
View file @
5e3bfdc7
...
...
@@ -457,7 +457,7 @@ extern "C" {
pub
fn
crocksdb_options_set_wal_recovery_mode
(
options
:
*
mut
Options
,
mode
:
DBRecoveryMode
);
pub
fn
crocksdb_options_set_max_subcompactions
(
options
:
*
mut
Options
,
v
:
u32
);
pub
fn
crocksdb_options_set_wal_bytes_per_sync
(
options
:
*
mut
Options
,
v
:
u64
);
pub
fn
crocksdb_options_enable_statistics
(
options
:
*
mut
Options
);
pub
fn
crocksdb_options_enable_statistics
(
options
:
*
mut
Options
,
v
:
bool
);
pub
fn
crocksdb_options_reset_statistics
(
options
:
*
mut
Options
);
pub
fn
crocksdb_options_statistics_get_string
(
options
:
*
mut
Options
)
->
*
const
c_char
;
pub
fn
crocksdb_options_statistics_get_ticker_count
(
...
...
src/main.rs
View file @
5e3bfdc7
...
...
@@ -147,10 +147,11 @@ mod tests {
opts
.set_max_background_jobs
(
4
);
cf_opts
.set_report_bg_io_stats
(
true
);
opts
.set_wal_recovery_mode
(
DBRecoveryMode
::
PointInTime
);
opts
.enable_statistics
();
opts
.enable_statistics
(
true
);
opts
.set_stats_dump_period_sec
(
60
);
cf_opts
.compression_per_level
(
&
per_level_compression
);
blockopts
.set_block_size
(
524288
);
blockopts
.set_no_block_cache
(
true
);
blockopts
.set_cache_index_and_filter_blocks
(
true
);
blockopts
.set_bloom_filter
(
10
,
false
);
cf_opts
.set_block_based_table_factory
(
blockopts
);
...
...
src/rocksdb_options.rs
View file @
5e3bfdc7
...
...
@@ -96,6 +96,12 @@ impl BlockBasedOptions {
}
}
pub
fn
set_no_block_cache
(
&
mut
self
,
v
:
bool
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_block_based_options_set_no_block_cache
(
self
.inner
,
v
);
}
}
pub
fn
set_bloom_filter
(
&
mut
self
,
bits_per_key
:
c_int
,
block_based
:
bool
)
{
unsafe
{
let
bloom
=
if
block_based
{
...
...
@@ -607,9 +613,9 @@ impl DBOptions {
}
}
pub
fn
enable_statistics
(
&
mut
self
)
{
pub
fn
enable_statistics
(
&
mut
self
,
v
:
bool
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_enable_statistics
(
self
.inner
);
crocksdb_ffi
::
crocksdb_options_enable_statistics
(
self
.inner
,
v
);
}
}
...
...
tests/test_rocksdb_options.rs
View file @
5e3bfdc7
...
...
@@ -70,7 +70,7 @@ fn test_set_max_manifest_file_size() {
#[test]
fn
test_enable_statistics
()
{
let
mut
opts
=
DBOptions
::
new
();
opts
.enable_statistics
();
opts
.enable_statistics
(
true
);
opts
.set_stats_dump_period_sec
(
60
);
assert
!
(
opts
.get_statistics
()
.is_some
());
assert
!
(
...
...
@@ -613,7 +613,7 @@ fn test_block_based_options() {
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
opts
.enable_statistics
();
opts
.enable_statistics
(
true
);
opts
.set_stats_dump_period_sec
(
60
);
let
mut
bopts
=
BlockBasedOptions
::
new
();
bopts
.set_read_amp_bytes_per_bit
(
4
);
...
...
tests/test_statistics.rs
View file @
5e3bfdc7
...
...
@@ -20,7 +20,7 @@ fn test_db_statistics() {
let
path
=
TempDir
::
new
(
"_rust_rocksdb_statistics"
)
.expect
(
""
);
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
opts
.enable_statistics
();
opts
.enable_statistics
(
true
);
let
db
=
DB
::
open
(
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
let
wopts
=
WriteOptions
::
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