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
dd413e47
Commit
dd413e47
authored
Dec 10, 2018
by
Huachao Huang
Committed by
dorianzheng
Dec 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: update ci and format (#248)
parent
f375f9ce
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
169 additions
and
113 deletions
+169
-113
.travis.yml
.travis.yml
+19
-20
lib.rs
librocksdb_sys/src/lib.rs
+4
-1
main.rs
src/main.rs
+5
-3
merge_operator.rs
src/merge_operator.rs
+6
-3
rocksdb.rs
src/rocksdb.rs
+9
-8
test_column_family.rs
tests/cases/test_column_family.rs
+7
-4
test_compact_range.rs
tests/cases/test_compact_range.rs
+2
-1
test_compaction_filter.rs
tests/cases/test_compaction_filter.rs
+8
-4
test_delete_range.rs
tests/cases/test_delete_range.rs
+26
-13
test_event_listener.rs
tests/cases/test_event_listener.rs
+8
-4
test_ingest_external_file.rs
tests/cases/test_ingest_external_file.rs
+9
-5
test_iterator.rs
tests/cases/test_iterator.rs
+8
-4
test_metadata.rs
tests/cases/test_metadata.rs
+4
-2
test_multithreaded.rs
tests/cases/test_multithreaded.rs
+5
-3
test_prefix_extractor.rs
tests/cases/test_prefix_extractor.rs
+4
-2
test_rocksdb_options.rs
tests/cases/test_rocksdb_options.rs
+30
-20
test_slice_transform.rs
tests/cases/test_slice_transform.rs
+2
-1
test_statistics.rs
tests/cases/test_statistics.rs
+6
-8
test_table_properties.rs
tests/cases/test_table_properties.rs
+7
-7
No files found.
.travis.yml
View file @
dd413e47
language
:
rust
dist
:
trusty
dist
:
trusty
sudo
:
required
sudo
:
required
rust
:
language
:
rust
-
beta
-
nightly
-
stable
cache
:
directories
:
-
target
os
:
os
:
-
linux
-
linux
rust
:
-
stable
-
beta
-
nightly
matrix
:
matrix
:
include
:
include
:
-
os
:
osx
-
os
:
osx
rust
:
stable
rust
:
stable
-
rust
:
stable
install
:
-
rustup component add rustfmt-preview
before_script
:
-
cargo fmt --all -- --check
script
:
-
cargo build
-
cargo test --all
env
:
env
:
global
:
global
:
-
RUST_TEST_THREADS=1
-
RUST_BACKTRACE=1
-
LD_LIBRARY_PATH
:
"
/usr/local/lib"
cache
:
directories
:
-
target
before_script
:
-
rustup component add rustfmt-preview
script
:
-
cargo fmt --all -- --check
-
cargo build
-
cargo test --all
librocksdb_sys/src/lib.rs
View file @
dd413e47
...
@@ -1449,7 +1449,10 @@ extern "C" {
...
@@ -1449,7 +1449,10 @@ extern "C" {
state
:
*
mut
c_void
,
state
:
*
mut
c_void
,
name
:
extern
"C"
fn
(
*
mut
c_void
)
->
*
const
c_char
,
name
:
extern
"C"
fn
(
*
mut
c_void
)
->
*
const
c_char
,
destruct
:
extern
"C"
fn
(
*
mut
c_void
),
destruct
:
extern
"C"
fn
(
*
mut
c_void
),
create_table_properties_collector
:
extern
"C"
fn
(
*
mut
c_void
,
uint32_t
)
create_table_properties_collector
:
extern
"C"
fn
(
*
mut
c_void
,
uint32_t
,
)
->
*
mut
DBTablePropertiesCollector
,
->
*
mut
DBTablePropertiesCollector
,
)
->
*
mut
DBTablePropertiesCollectorFactory
;
)
->
*
mut
DBTablePropertiesCollectorFactory
;
...
...
src/main.rs
View file @
dd413e47
...
@@ -68,9 +68,11 @@ fn main() {
...
@@ -68,9 +68,11 @@ fn main() {
fn
concat_merge
(
_
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
fn
concat_merge
(
_
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
operands
.size_hint
()
.
0
);
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
operands
.size_hint
()
.
0
);
match
existing_val
{
match
existing_val
{
Some
(
v
)
=>
for
e
in
v
{
Some
(
v
)
=>
{
result
.push
(
*
e
)
for
e
in
v
{
},
result
.push
(
*
e
)
}
}
None
=>
(),
None
=>
(),
}
}
for
op
in
operands
{
for
op
in
operands
{
...
...
src/merge_operator.rs
View file @
dd413e47
...
@@ -190,7 +190,8 @@ mod test {
...
@@ -190,7 +190,8 @@ mod test {
opts
.clone
(),
opts
.clone
(),
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
.clone
())],
vec!
[(
"default"
,
cf_opts
.clone
())],
)
.unwrap
();
)
.unwrap
();
let
p
=
db
.put
(
b
"k1"
,
b
"a"
);
let
p
=
db
.put
(
b
"k1"
,
b
"a"
);
assert
!
(
p
.is_ok
());
assert
!
(
p
.is_ok
());
let
_
=
db
.merge
(
b
"k1"
,
b
"b"
);
let
_
=
db
.merge
(
b
"k1"
,
b
"b"
);
...
@@ -228,7 +229,8 @@ mod test {
...
@@ -228,7 +229,8 @@ mod test {
opts
.clone
(),
opts
.clone
(),
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
.clone
())],
vec!
[(
"default"
,
cf_opts
.clone
())],
)
.unwrap
();
)
.unwrap
();
let
r
:
Result
<
Option
<
DBVector
>
,
String
>
=
db
.get
(
b
"k1"
);
let
r
:
Result
<
Option
<
DBVector
>
,
String
>
=
db
.get
(
b
"k1"
);
assert_eq!
(
r
.unwrap
()
.unwrap
(),
b
"abcdefgh"
);
assert_eq!
(
r
.unwrap
()
.unwrap
(),
b
"abcdefgh"
);
...
@@ -245,7 +247,8 @@ mod test {
...
@@ -245,7 +247,8 @@ mod test {
opts
.clone
(),
opts
.clone
(),
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
assert
!
(
db
.get
(
b
"k1"
)
.unwrap
()
.is_none
());
assert
!
(
db
.get
(
b
"k1"
)
.unwrap
()
.is_none
());
let
r
:
Result
<
Option
<
DBVector
>
,
String
>
=
db
.get
(
b
"k2"
);
let
r
:
Result
<
Option
<
DBVector
>
,
String
>
=
db
.get
(
b
"k2"
);
...
...
src/rocksdb.rs
View file @
dd413e47
...
@@ -2394,7 +2394,8 @@ mod test {
...
@@ -2394,7 +2394,8 @@ mod test {
db
.put
(
db
.put
(
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
)
.expect
(
""
);
)
.expect
(
""
);
}
}
db
.flush
(
true
)
.expect
(
""
);
db
.flush
(
true
)
.expect
(
""
);
assert
!
(
db
.get
(
b
"0001"
)
.expect
(
""
)
.is_some
());
assert
!
(
db
.get
(
b
"0001"
)
.expect
(
""
)
.is_some
());
...
@@ -2482,7 +2483,8 @@ mod test {
...
@@ -2482,7 +2483,8 @@ mod test {
restore_dir
.path
()
.to_str
()
.unwrap
(),
restore_dir
.path
()
.to_str
()
.unwrap
(),
restore_dir
.path
()
.to_str
()
.unwrap
(),
restore_dir
.path
()
.to_str
()
.unwrap
(),
&
ropt
,
&
ropt
,
)
.unwrap
();
)
.unwrap
();
let
r
=
restored_db
.get
(
key
);
let
r
=
restored_db
.get
(
key
);
assert
!
(
r
.unwrap
()
.unwrap
()
.to_utf8
()
.unwrap
()
==
str
::
from_utf8
(
value
)
.unwrap
());
assert
!
(
r
.unwrap
()
.unwrap
()
.to_utf8
()
.unwrap
()
==
str
::
from_utf8
(
value
)
.unwrap
());
...
@@ -2563,7 +2565,8 @@ mod test {
...
@@ -2563,7 +2565,8 @@ mod test {
db1
.put
(
b
"k2"
,
b
"v2"
)
.unwrap
();
db1
.put
(
b
"k2"
,
b
"v2"
)
.unwrap
();
db1
.flush
(
true
)
.unwrap
();
db1
.flush
(
true
)
.unwrap
();
db1
.compact_range
(
None
,
None
);
db1
.compact_range
(
None
,
None
);
})
.unwrap
();
})
.unwrap
();
// Wait until all currently running background processes finish.
// Wait until all currently running background processes finish.
db
.pause_bg_work
();
db
.pause_bg_work
();
assert_eq!
(
assert_eq!
(
...
@@ -2746,11 +2749,9 @@ mod test {
...
@@ -2746,11 +2749,9 @@ mod test {
let
cf_name
:
&
str
=
"cf_dynamic_level_bytes"
;
let
cf_name
:
&
str
=
"cf_dynamic_level_bytes"
;
// test when options not exist
// test when options not exist
assert
!
(
assert
!
(
load_latest_options
(
dbpath
,
&
Env
::
default
(),
false
)
load_latest_options
(
dbpath
,
&
Env
::
default
(),
false
)
.unwrap
()
.unwrap
()
.is_none
());
.is_none
()
);
let
mut
opts
=
DBOptions
::
new
();
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
opts
.create_if_missing
(
true
);
...
...
tests/cases/test_column_family.rs
View file @
dd413e47
...
@@ -116,7 +116,8 @@ pub fn test_column_family() {
...
@@ -116,7 +116,8 @@ pub fn test_column_family() {
DBOptions
::
new
(),
DBOptions
::
new
(),
path_str
,
path_str
,
vec!
[(
"cf1"
,
ColumnFamilyOptions
::
new
())],
vec!
[(
"cf1"
,
ColumnFamilyOptions
::
new
())],
)
.unwrap
();
)
.unwrap
();
match
db
.drop_cf
(
"cf1"
)
{
match
db
.drop_cf
(
"cf1"
)
{
Ok
(
_
)
=>
println!
(
"cf1 successfully dropped."
),
Ok
(
_
)
=>
println!
(
"cf1 successfully dropped."
),
Err
(
e
)
=>
panic!
(
"failed to drop column family: {}"
,
e
),
Err
(
e
)
=>
panic!
(
"failed to drop column family: {}"
,
e
),
...
@@ -132,9 +133,11 @@ fn test_provided_merge(
...
@@ -132,9 +133,11 @@ fn test_provided_merge(
let
nops
=
operands
.size_hint
()
.
0
;
let
nops
=
operands
.size_hint
()
.
0
;
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
nops
);
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
nops
);
match
existing_val
{
match
existing_val
{
Some
(
v
)
=>
for
e
in
v
{
Some
(
v
)
=>
{
result
.push
(
*
e
);
for
e
in
v
{
},
result
.push
(
*
e
);
}
}
None
=>
(),
None
=>
(),
}
}
for
op
in
operands
{
for
op
in
operands
{
...
...
tests/cases/test_compact_range.rs
View file @
dd413e47
...
@@ -59,7 +59,8 @@ fn test_compact_range_change_level() {
...
@@ -59,7 +59,8 @@ fn test_compact_range_change_level() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
samples
=
vec!
[
let
samples
=
vec!
[
(
b
"k1"
.to_vec
(),
b
"value--------1"
.to_vec
()),
(
b
"k1"
.to_vec
(),
b
"value--------1"
.to_vec
()),
(
b
"k2"
.to_vec
(),
b
"value--------2"
.to_vec
()),
(
b
"k2"
.to_vec
(),
b
"value--------2"
.to_vec
()),
...
...
tests/cases/test_compaction_filter.rs
View file @
dd413e47
...
@@ -52,14 +52,16 @@ fn test_compaction_filter() {
...
@@ -52,14 +52,16 @@ fn test_compaction_filter() {
drop_called
:
drop_called
.clone
(),
drop_called
:
drop_called
.clone
(),
filtered_kvs
:
filtered_kvs
.clone
(),
filtered_kvs
:
filtered_kvs
.clone
(),
}),
}),
)
.unwrap
();
)
.unwrap
();
let
mut
opts
=
DBOptions
::
new
();
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
opts
.create_if_missing
(
true
);
let
db
=
DB
::
open_cf
(
let
db
=
DB
::
open_cf
(
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
samples
=
vec!
[
let
samples
=
vec!
[
(
b
"key1"
.to_vec
(),
b
"value1"
.to_vec
()),
(
b
"key1"
.to_vec
(),
b
"value1"
.to_vec
()),
(
b
"key2"
.to_vec
(),
b
"value2"
.to_vec
()),
(
b
"key2"
.to_vec
(),
b
"value2"
.to_vec
()),
...
@@ -91,7 +93,8 @@ fn test_compaction_filter() {
...
@@ -91,7 +93,8 @@ fn test_compaction_filter() {
drop_called
:
drop_called
.clone
(),
drop_called
:
drop_called
.clone
(),
filtered_kvs
:
filtered_kvs
.clone
(),
filtered_kvs
:
filtered_kvs
.clone
(),
}),
}),
)
.unwrap
();
)
.unwrap
();
assert
!
(
drop_called
.load
(
Ordering
::
Relaxed
));
assert
!
(
drop_called
.load
(
Ordering
::
Relaxed
));
drop_called
.store
(
false
,
Ordering
::
Relaxed
);
drop_called
.store
(
false
,
Ordering
::
Relaxed
);
{
{
...
@@ -99,7 +102,8 @@ fn test_compaction_filter() {
...
@@ -99,7 +102,8 @@ fn test_compaction_filter() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
_snap
=
db
.snapshot
();
let
_snap
=
db
.snapshot
();
// Because ignore_snapshots is true, so all the keys will be compacted.
// Because ignore_snapshots is true, so all the keys will be compacted.
db
.compact_range
(
Some
(
b
"key1"
),
Some
(
b
"key3"
));
db
.compact_range
(
Some
(
b
"key1"
),
Some
(
b
"key3"
));
...
...
tests/cases/test_delete_range.rs
View file @
dd413e47
...
@@ -640,7 +640,8 @@ fn test_delete_range_prefix_bloom_case_1() {
...
@@ -640,7 +640,8 @@ fn test_delete_range_prefix_bloom_case_1() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -714,7 +715,8 @@ fn test_delete_range_prefix_bloom_case_2() {
...
@@ -714,7 +715,8 @@ fn test_delete_range_prefix_bloom_case_2() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -769,7 +771,8 @@ fn test_delete_range_prefix_bloom_case_2() {
...
@@ -769,7 +771,8 @@ fn test_delete_range_prefix_bloom_case_2() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -805,7 +808,8 @@ fn test_delete_range_prefix_bloom_case_3() {
...
@@ -805,7 +808,8 @@ fn test_delete_range_prefix_bloom_case_3() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -849,7 +853,8 @@ fn test_delete_range_prefix_bloom_case_3() {
...
@@ -849,7 +853,8 @@ fn test_delete_range_prefix_bloom_case_3() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -899,7 +904,8 @@ fn test_delete_range_prefix_bloom_case_4() {
...
@@ -899,7 +904,8 @@ fn test_delete_range_prefix_bloom_case_4() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -943,7 +949,8 @@ fn test_delete_range_prefix_bloom_case_4() {
...
@@ -943,7 +949,8 @@ fn test_delete_range_prefix_bloom_case_4() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -994,7 +1001,8 @@ fn test_delete_range_prefix_bloom_case_5() {
...
@@ -994,7 +1001,8 @@ fn test_delete_range_prefix_bloom_case_5() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -1036,7 +1044,8 @@ fn test_delete_range_prefix_bloom_case_5() {
...
@@ -1036,7 +1044,8 @@ fn test_delete_range_prefix_bloom_case_5() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
db2
=
DB
::
open_cf
(
opts
,
path_str
,
vec!
[(
cf
,
cf_opts
)])
.unwrap
();
let
db2
=
DB
::
open_cf
(
opts
,
path_str
,
vec!
[(
cf
,
cf_opts
)])
.unwrap
();
...
@@ -1084,7 +1093,8 @@ fn test_delete_range_prefix_bloom_case_6() {
...
@@ -1084,7 +1093,8 @@ fn test_delete_range_prefix_bloom_case_6() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -1128,7 +1138,8 @@ fn test_delete_range_prefix_bloom_case_6() {
...
@@ -1128,7 +1138,8 @@ fn test_delete_range_prefix_bloom_case_6() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
db2
=
DB
::
open_cf
(
opts
,
path_str
,
vec!
[(
cf
,
cf_opts
)])
.unwrap
();
let
db2
=
DB
::
open_cf
(
opts
,
path_str
,
vec!
[(
cf
,
cf_opts
)])
.unwrap
();
...
@@ -1200,7 +1211,8 @@ fn test_delete_range_prefix_bloom_compact_case() {
...
@@ -1200,7 +1211,8 @@ fn test_delete_range_prefix_bloom_compact_case() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
cf
=
"default"
;
let
cf
=
"default"
;
...
@@ -1244,7 +1256,8 @@ fn test_delete_range_prefix_bloom_compact_case() {
...
@@ -1244,7 +1256,8 @@ fn test_delete_range_prefix_bloom_compact_case() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixSliceTransform"
,
"FixedSuffixSliceTransform"
,
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
Box
::
new
(
FixedSuffixSliceTransform
::
new
(
3
)),
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
)
.unwrap_or_else
(|
err
|
panic!
(
format!
(
"{:?}"
,
err
)));
// Create prefix bloom filter for memtable.
// Create prefix bloom filter for memtable.
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
db2
=
DB
::
open_cf
(
opts
,
path_str
,
vec!
[(
cf
,
cf_opts
)])
.unwrap
();
let
db2
=
DB
::
open_cf
(
opts
,
path_str
,
vec!
[(
cf
,
cf_opts
)])
.unwrap
();
...
...
tests/cases/test_event_listener.rs
View file @
dd413e47
...
@@ -137,7 +137,8 @@ fn test_event_listener_stall_conditions_changed() {
...
@@ -137,7 +137,8 @@ fn test_event_listener_stall_conditions_changed() {
opts
,
opts
,
path_str
,
path_str
,
vec!
[(
"default"
,
ColumnFamilyOptions
::
new
())],
vec!
[(
"default"
,
ColumnFamilyOptions
::
new
())],
)
.unwrap
();
)
.unwrap
();
db
.create_cf
((
"test_cf"
,
cf_opts
))
.unwrap
();
db
.create_cf
((
"test_cf"
,
cf_opts
))
.unwrap
();
let
test_cf
=
db
.cf_handle
(
"test_cf"
)
.unwrap
();
let
test_cf
=
db
.cf_handle
(
"test_cf"
)
.unwrap
();
...
@@ -146,7 +147,8 @@ fn test_event_listener_stall_conditions_changed() {
...
@@ -146,7 +147,8 @@ fn test_event_listener_stall_conditions_changed() {
test_cf
,
test_cf
,
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
)
.unwrap
();
)
.unwrap
();
db
.flush_cf
(
test_cf
,
true
)
.unwrap
();
db
.flush_cf
(
test_cf
,
true
)
.unwrap
();
}
}
let
flush_cnt
=
counter
.flush
.load
(
Ordering
::
SeqCst
);
let
flush_cnt
=
counter
.flush
.load
(
Ordering
::
SeqCst
);
...
@@ -177,7 +179,8 @@ fn test_event_listener_basic() {
...
@@ -177,7 +179,8 @@ fn test_event_listener_basic() {
db
.put
(
db
.put
(
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
)
.unwrap
();
)
.unwrap
();
}
}
db
.flush
(
true
)
.unwrap
();
db
.flush
(
true
)
.unwrap
();
assert_ne!
(
counter
.flush
.load
(
Ordering
::
SeqCst
),
0
);
assert_ne!
(
counter
.flush
.load
(
Ordering
::
SeqCst
),
0
);
...
@@ -186,7 +189,8 @@ fn test_event_listener_basic() {
...
@@ -186,7 +189,8 @@ fn test_event_listener_basic() {
db
.put
(
db
.put
(
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
format!
(
"{:04}"
,
i
)
.as_bytes
(),
)
.unwrap
();
)
.unwrap
();
}
}
db
.flush
(
true
)
.unwrap
();
db
.flush
(
true
)
.unwrap
();
let
flush_cnt
=
counter
.flush
.load
(
Ordering
::
SeqCst
);
let
flush_cnt
=
counter
.flush
.load
(
Ordering
::
SeqCst
);
...
...
tests/cases/test_ingest_external_file.rs
View file @
dd413e47
...
@@ -82,9 +82,11 @@ fn gen_sst_delete(opt: ColumnFamilyOptions, cf: Option<&CFHandle>, path: &str) {
...
@@ -82,9 +82,11 @@ fn gen_sst_delete(opt: ColumnFamilyOptions, cf: Option<&CFHandle>, path: &str) {
fn
concat_merge
(
_
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
fn
concat_merge
(
_
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
operands
.size_hint
()
.
0
);
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
operands
.size_hint
()
.
0
);
match
existing_val
{
match
existing_val
{
Some
(
v
)
=>
for
e
in
v
{
Some
(
v
)
=>
{
result
.push
(
*
e
)
for
e
in
v
{
},
result
.push
(
*
e
)
}
}
None
=>
(),
None
=>
(),
}
}
for
op
in
operands
{
for
op
in
operands
{
...
@@ -342,7 +344,8 @@ fn test_ingest_simulate_real_world() {
...
@@ -342,7 +344,8 @@ fn test_ingest_simulate_real_world() {
handle
,
handle
,
&
ingest_opt
,
&
ingest_opt
,
&
[
gen_path
.path
()
.join
(
cf
)
.to_str
()
.unwrap
()],
&
[
gen_path
.path
()
.join
(
cf
)
.to_str
()
.unwrap
()],
)
.unwrap
();
)
.unwrap
();
check_kv
(
check_kv
(
&
db
,
&
db
,
db
.cf_handle
(
cf
),
db
.cf_handle
(
cf
),
...
@@ -369,7 +372,8 @@ fn test_ingest_simulate_real_world() {
...
@@ -369,7 +372,8 @@ fn test_ingest_simulate_real_world() {
handle
,
handle
,
&
ingest_opt
,
&
ingest_opt
,
&
[
gen_path
.path
()
.join
(
cf
)
.to_str
()
.unwrap
()],
&
[
gen_path
.path
()
.join
(
cf
)
.to_str
()
.unwrap
()],
)
.unwrap
();
)
.unwrap
();
check_kv
(
check_kv
(
&
db
,
&
db
,
db
.cf_handle
(
cf
),
db
.cf_handle
(
cf
),
...
...
tests/cases/test_iterator.rs
View file @
dd413e47
...
@@ -300,7 +300,8 @@ fn test_total_order_seek() {
...
@@ -300,7 +300,8 @@ fn test_total_order_seek() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedPrefixTransform"
,
"FixedPrefixTransform"
,
Box
::
new
(
FixedPrefixTransform
{
prefix_len
:
2
}),
Box
::
new
(
FixedPrefixTransform
{
prefix_len
:
2
}),
)
.unwrap
();
)
.unwrap
();
// also create prefix bloom for memtable
// also create prefix bloom for memtable
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
...
@@ -311,7 +312,8 @@ fn test_total_order_seek() {
...
@@ -311,7 +312,8 @@ fn test_total_order_seek() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
wopts
=
WriteOptions
::
new
();
let
wopts
=
WriteOptions
::
new
();
// sst1
// sst1
...
@@ -386,13 +388,15 @@ fn test_fixed_suffix_seek() {
...
@@ -386,13 +388,15 @@ fn test_fixed_suffix_seek() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedSuffixTransform"
,
"FixedSuffixTransform"
,
Box
::
new
(
FixedSuffixTransform
{
suffix_len
:
2
}),
Box
::
new
(
FixedSuffixTransform
{
suffix_len
:
2
}),
)
.unwrap
();
)
.unwrap
();
let
db
=
DB
::
open_cf
(
let
db
=
DB
::
open_cf
(
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
db
.put
(
b
"k-eghe-5"
,
b
"a"
)
.unwrap
();
db
.put
(
b
"k-eghe-5"
,
b
"a"
)
.unwrap
();
db
.put
(
b
"k-24yfae-6"
,
b
"a"
)
.unwrap
();
db
.put
(
b
"k-24yfae-6"
,
b
"a"
)
.unwrap
();
db
.put
(
b
"k-h1fwd-7"
,
b
"a"
)
.unwrap
();
db
.put
(
b
"k-h1fwd-7"
,
b
"a"
)
.unwrap
();
...
...
tests/cases/test_metadata.rs
View file @
dd413e47
...
@@ -27,7 +27,8 @@ fn test_metadata() {
...
@@ -27,7 +27,8 @@ fn test_metadata() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
cf_handle
=
db
.cf_handle
(
"default"
)
.unwrap
();
let
cf_handle
=
db
.cf_handle
(
"default"
)
.unwrap
();
let
num_files
=
5
;
let
num_files
=
5
;
...
@@ -80,7 +81,8 @@ fn test_compact_files() {
...
@@ -80,7 +81,8 @@ fn test_compact_files() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
cf_handle
=
db
.cf_handle
(
"default"
)
.unwrap
();
let
cf_handle
=
db
.cf_handle
(
"default"
)
.unwrap
();
let
cf_opts
=
db
.get_options_cf
(
cf_handle
);
let
cf_opts
=
db
.get_options_cf
(
cf_handle
);
...
...
tests/cases/test_multithreaded.rs
View file @
dd413e47
...
@@ -45,9 +45,11 @@ pub fn test_multithreaded() {
...
@@ -45,9 +45,11 @@ pub fn test_multithreaded() {
let
j3
=
thread
::
spawn
(
move
||
{
let
j3
=
thread
::
spawn
(
move
||
{
for
_
in
1
..
N
{
for
_
in
1
..
N
{
match
db3
.get
(
b
"key"
)
{
match
db3
.get
(
b
"key"
)
{
Ok
(
Some
(
v
))
=>
if
&
v
[
..
]
!=
b
"value1"
&&
&
v
[
..
]
!=
b
"value2"
{
Ok
(
Some
(
v
))
=>
{
assert
!
(
false
);
if
&
v
[
..
]
!=
b
"value1"
&&
&
v
[
..
]
!=
b
"value2"
{
},
assert
!
(
false
);
}
}
_
=>
{
_
=>
{
assert
!
(
false
);
assert
!
(
false
);
}
}
...
...
tests/cases/test_prefix_extractor.rs
View file @
dd413e47
...
@@ -62,14 +62,16 @@ fn test_prefix_extractor_compatibility() {
...
@@ -62,14 +62,16 @@ fn test_prefix_extractor_compatibility() {
.set_prefix_extractor
(
.set_prefix_extractor
(
"FixedPrefixTransform"
,
"FixedPrefixTransform"
,
Box
::
new
(
FixedPrefixTransform
{
prefix_len
:
2
}),
Box
::
new
(
FixedPrefixTransform
{
prefix_len
:
2
}),
)
.unwrap
();
)
.unwrap
();
// also create prefix bloom for memtable
// also create prefix bloom for memtable
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
cf_opts
.set_memtable_prefix_bloom_size_ratio
(
0.1
as
f64
);
let
db
=
DB
::
open_cf
(
let
db
=
DB
::
open_cf
(
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
wopts
=
WriteOptions
::
new
();
let
wopts
=
WriteOptions
::
new
();
// sst2 with prefix bloom.
// sst2 with prefix bloom.
...
...
tests/cases/test_rocksdb_options.rs
View file @
dd413e47
...
@@ -37,7 +37,8 @@ fn test_set_num_levels() {
...
@@ -37,7 +37,8 @@ fn test_set_num_levels() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
drop
(
db
);
drop
(
db
);
}
}
...
@@ -75,14 +76,12 @@ fn test_enable_statistics() {
...
@@ -75,14 +76,12 @@ fn test_enable_statistics() {
opts
.enable_statistics
(
true
);
opts
.enable_statistics
(
true
);
opts
.set_stats_dump_period_sec
(
60
);
opts
.set_stats_dump_period_sec
(
60
);
assert
!
(
opts
.get_statistics
()
.is_some
());
assert
!
(
opts
.get_statistics
()
.is_some
());
assert
!
(
assert
!
(
opts
opts
.get_statistics_histogram
(
HistogramType
::
DbSeek
)
.get_statistics_histogram
(
HistogramType
::
DbSeek
)
.is_some
()
.is_some
());
);
assert
!
(
opts
assert
!
(
.get_statistics_histogram_string
(
HistogramType
::
DbSeek
)
opts
.get_statistics_histogram_string
(
HistogramType
::
DbSeek
)
.is_some
());
.is_some
()
);
assert_eq!
(
assert_eq!
(
opts
.get_statistics_ticker_count
(
TickerType
::
BlockCacheMiss
),
opts
.get_statistics_ticker_count
(
TickerType
::
BlockCacheMiss
),
0
0
...
@@ -124,12 +123,14 @@ fn test_memtable_insert_hint_prefix_extractor() {
...
@@ -124,12 +123,14 @@ fn test_memtable_insert_hint_prefix_extractor() {
.set_memtable_insert_hint_prefix_extractor
(
.set_memtable_insert_hint_prefix_extractor
(
"FixedPrefixTransform"
,
"FixedPrefixTransform"
,
Box
::
new
(
FixedPrefixTransform
{
prefix_len
:
2
}),
Box
::
new
(
FixedPrefixTransform
{
prefix_len
:
2
}),
)
.unwrap
();
)
.unwrap
();
let
db
=
DB
::
open_cf
(
let
db
=
DB
::
open_cf
(
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
wopts
=
WriteOptions
::
new
();
let
wopts
=
WriteOptions
::
new
();
db
.put_opt
(
b
"k0-1"
,
b
"a"
,
&
wopts
)
.unwrap
();
db
.put_opt
(
b
"k0-1"
,
b
"a"
,
&
wopts
)
.unwrap
();
...
@@ -262,7 +263,8 @@ fn test_set_pin_l0_filter_and_index_blocks_in_cache() {
...
@@ -262,7 +263,8 @@ fn test_set_pin_l0_filter_and_index_blocks_in_cache() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
@@ -290,7 +292,8 @@ fn test_set_cache_index_and_filter_blocks_with_high_priority() {
...
@@ -290,7 +292,8 @@ fn test_set_cache_index_and_filter_blocks_with_high_priority() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
@@ -305,7 +308,8 @@ fn test_pending_compaction_bytes_limit() {
...
@@ -305,7 +308,8 @@ fn test_pending_compaction_bytes_limit() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
@@ -338,7 +342,8 @@ fn test_set_optimize_filters_for_hits() {
...
@@ -338,7 +342,8 @@ fn test_set_optimize_filters_for_hits() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
@@ -357,7 +362,8 @@ fn test_get_block_cache_usage() {
...
@@ -357,7 +362,8 @@ fn test_get_block_cache_usage() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
for
i
in
0
..
200
{
for
i
in
0
..
200
{
db
.put
(
format!
(
"k_{}"
,
i
)
.as_bytes
(),
b
"v"
)
.unwrap
();
db
.put
(
format!
(
"k_{}"
,
i
)
.as_bytes
(),
b
"v"
)
.unwrap
();
...
@@ -384,7 +390,8 @@ fn test_block_cache_capacity() {
...
@@ -384,7 +390,8 @@ fn test_block_cache_capacity() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
assert_eq!
(
assert_eq!
(
db
.get_options
()
.get_block_cache_capacity
(),
db
.get_options
()
.get_block_cache_capacity
(),
...
@@ -421,7 +428,8 @@ fn test_set_level_compaction_dynamic_level_bytes() {
...
@@ -421,7 +428,8 @@ fn test_set_level_compaction_dynamic_level_bytes() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
@@ -477,7 +485,8 @@ fn test_set_compaction_pri() {
...
@@ -477,7 +485,8 @@ fn test_set_compaction_pri() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
@@ -552,7 +561,8 @@ fn test_bottommost_compression() {
...
@@ -552,7 +561,8 @@ fn test_bottommost_compression() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
}
}
#[test]
#[test]
...
...
tests/cases/test_slice_transform.rs
View file @
dd413e47
...
@@ -53,7 +53,8 @@ fn test_slice_transform() {
...
@@ -53,7 +53,8 @@ fn test_slice_transform() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
samples
=
vec!
[
let
samples
=
vec!
[
(
b
"key_01"
.to_vec
(),
b
"1"
.to_vec
()),
(
b
"key_01"
.to_vec
(),
b
"1"
.to_vec
()),
(
b
"key_02"
.to_vec
(),
b
"2"
.to_vec
()),
(
b
"key_02"
.to_vec
(),
b
"2"
.to_vec
()),
...
...
tests/cases/test_statistics.rs
View file @
dd413e47
...
@@ -35,10 +35,9 @@ fn test_db_statistics() {
...
@@ -35,10 +35,9 @@ fn test_db_statistics() {
assert
!
(
db
.get_statistics_ticker_count
(
TickerType
::
BlockCacheHit
)
>
0
);
assert
!
(
db
.get_statistics_ticker_count
(
TickerType
::
BlockCacheHit
)
>
0
);
assert
!
(
db
.get_and_reset_statistics_ticker_count
(
TickerType
::
BlockCacheHit
)
>
0
);
assert
!
(
db
.get_and_reset_statistics_ticker_count
(
TickerType
::
BlockCacheHit
)
>
0
);
assert_eq!
(
db
.get_statistics_ticker_count
(
TickerType
::
BlockCacheHit
),
0
);
assert_eq!
(
db
.get_statistics_ticker_count
(
TickerType
::
BlockCacheHit
),
0
);
assert
!
(
assert
!
(
db
db
.get_statistics_histogram_string
(
HistogramType
::
DbGet
)
.get_statistics_histogram_string
(
HistogramType
::
DbGet
)
.is_some
()
.is_some
());
);
assert
!
(
db
.get_statistics_histogram
(
HistogramType
::
DbGet
)
.is_some
());
assert
!
(
db
.get_statistics_histogram
(
HistogramType
::
DbGet
)
.is_some
());
let
get_micros
=
db
.get_statistics_histogram
(
HistogramType
::
DbGet
)
.unwrap
();
let
get_micros
=
db
.get_statistics_histogram
(
HistogramType
::
DbGet
)
.unwrap
();
...
@@ -70,9 +69,8 @@ fn test_disable_db_statistics() {
...
@@ -70,9 +69,8 @@ fn test_disable_db_statistics() {
db
.get_and_reset_statistics_ticker_count
(
TickerType
::
BlockCacheHit
),
db
.get_and_reset_statistics_ticker_count
(
TickerType
::
BlockCacheHit
),
0
0
);
);
assert
!
(
assert
!
(
db
db
.get_statistics_histogram_string
(
HistogramType
::
DbGet
)
.get_statistics_histogram_string
(
HistogramType
::
DbGet
)
.is_none
()
.is_none
());
);
assert
!
(
db
.get_statistics_histogram
(
HistogramType
::
DbGet
)
.is_none
());
assert
!
(
db
.get_statistics_histogram
(
HistogramType
::
DbGet
)
.is_none
());
}
}
tests/cases/test_table_properties.rs
View file @
dd413e47
...
@@ -84,11 +84,9 @@ impl ExampleCollector {
...
@@ -84,11 +84,9 @@ impl ExampleCollector {
for
(
k
,
v
)
in
props
{
for
(
k
,
v
)
in
props
{
assert_eq!
(
v
,
props
.get
(
k
)
.unwrap
());
assert_eq!
(
v
,
props
.get
(
k
)
.unwrap
());
}
}
assert
!
(
assert
!
(
props
props
.get
(
&
[
Props
::
NumKeys
as
u8
,
Props
::
NumPuts
as
u8
])
.get
(
&
[
Props
::
NumKeys
as
u8
,
Props
::
NumPuts
as
u8
])
.is_none
());
.is_none
()
);
assert
!
(
props
.len
()
>=
4
);
assert
!
(
props
.len
()
>=
4
);
c
c
...
@@ -176,7 +174,8 @@ fn test_table_properties_collector_factory() {
...
@@ -176,7 +174,8 @@ fn test_table_properties_collector_factory() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
let
samples
=
vec!
[
let
samples
=
vec!
[
(
b
"key1"
.to_vec
(),
b
"value1"
.to_vec
()),
(
b
"key1"
.to_vec
(),
b
"value1"
.to_vec
()),
...
@@ -249,7 +248,8 @@ fn test_table_properties_with_table_filter() {
...
@@ -249,7 +248,8 @@ fn test_table_properties_with_table_filter() {
opts
,
opts
,
path
.path
()
.to_str
()
.unwrap
(),
path
.path
()
.to_str
()
.unwrap
(),
vec!
[(
"default"
,
cf_opts
)],
vec!
[(
"default"
,
cf_opts
)],
)
.unwrap
();
)
.unwrap
();
// Generate a sst with 4 entries.
// Generate a sst with 4 entries.
let
samples
=
vec!
[
let
samples
=
vec!
[
...
...
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