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
002ff06b
Unverified
Commit
002ff06b
authored
May 12, 2020
by
Connor
Committed by
GitHub
May 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy rocksdb options to titan options when using (#488)
Signed-off-by:
Connor1996
<
zbk602423539@gmail.com
>
parent
a4419e76
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
rocksdb.rs
src/rocksdb.rs
+15
-1
rocksdb_options.rs
src/rocksdb_options.rs
+0
-2
test_titan.rs
tests/cases/test_titan.rs
+2
-2
No files found.
src/rocksdb.rs
View file @
002ff06b
...
@@ -585,7 +585,14 @@ impl DB {
...
@@ -585,7 +585,14 @@ impl DB {
.collect
();
.collect
();
let
titan_cf_options
:
Vec
<
_
>
=
options
let
titan_cf_options
:
Vec
<
_
>
=
options
.iter
()
.iter
()
.map
(|
x
|
x
.titan_inner
as
*
const
crocksdb_ffi
::
DBTitanDBOptions
)
.map
(|
x
|
{
if
!
x
.titan_inner
.is_null
()
{
unsafe
{
crocksdb_ffi
::
ctitandb_options_set_rocksdb_options
(
x
.titan_inner
,
x
.inner
);
}
}
x
.titan_inner
as
*
const
crocksdb_ffi
::
DBTitanDBOptions
})
.collect
();
.collect
();
let
readonly
=
error_if_log_file_exist
.is_some
();
let
readonly
=
error_if_log_file_exist
.is_some
();
...
@@ -611,6 +618,9 @@ impl DB {
...
@@ -611,6 +618,9 @@ impl DB {
let
titan_options
=
opts
.titan_inner
;
let
titan_options
=
opts
.titan_inner
;
if
!
titan_options
.is_null
()
{
if
!
titan_options
.is_null
()
{
unsafe
{
crocksdb_ffi
::
ctitandb_options_set_rocksdb_options
(
titan_options
,
db_options
);
}
if
error_if_log_file_exist
.is_some
()
{
if
error_if_log_file_exist
.is_some
()
{
return
Err
(
"TitanDB doesn't support read only mode."
.to_owned
());
return
Err
(
"TitanDB doesn't support read only mode."
.to_owned
());
}
else
if
with_ttl
{
}
else
if
with_ttl
{
...
@@ -878,6 +888,10 @@ impl DB {
...
@@ -878,6 +888,10 @@ impl DB {
if
cfd
.options.titan_inner
.is_null
()
{
if
cfd
.options.titan_inner
.is_null
()
{
cfd
.options
.set_titandb_options
(
&
TitanDBOptions
::
new
());
cfd
.options
.set_titandb_options
(
&
TitanDBOptions
::
new
());
}
}
crocksdb_ffi
::
ctitandb_options_set_rocksdb_options
(
cfd
.options.titan_inner
,
cfd
.options.inner
,
);
ffi_try!
(
ctitandb_create_column_family
(
ffi_try!
(
ctitandb_create_column_family
(
self
.inner
,
self
.inner
,
cfd
.options.titan_inner
,
cfd
.options.titan_inner
,
...
...
src/rocksdb_options.rs
View file @
002ff06b
...
@@ -698,7 +698,6 @@ impl DBOptions {
...
@@ -698,7 +698,6 @@ impl DBOptions {
pub
fn
set_titandb_options
(
&
mut
self
,
opts
:
&
TitanDBOptions
)
{
pub
fn
set_titandb_options
(
&
mut
self
,
opts
:
&
TitanDBOptions
)
{
unsafe
{
unsafe
{
self
.titan_inner
=
crocksdb_ffi
::
ctitandb_options_copy
(
opts
.inner
);
self
.titan_inner
=
crocksdb_ffi
::
ctitandb_options_copy
(
opts
.inner
);
crocksdb_ffi
::
ctitandb_options_set_rocksdb_options
(
self
.titan_inner
,
self
.inner
);
}
}
}
}
...
@@ -1226,7 +1225,6 @@ impl ColumnFamilyOptions {
...
@@ -1226,7 +1225,6 @@ impl ColumnFamilyOptions {
pub
fn
set_titandb_options
(
&
mut
self
,
opts
:
&
TitanDBOptions
)
{
pub
fn
set_titandb_options
(
&
mut
self
,
opts
:
&
TitanDBOptions
)
{
unsafe
{
unsafe
{
self
.titan_inner
=
crocksdb_ffi
::
ctitandb_options_copy
(
opts
.inner
);
self
.titan_inner
=
crocksdb_ffi
::
ctitandb_options_copy
(
opts
.inner
);
crocksdb_ffi
::
ctitandb_options_set_rocksdb_options
(
self
.titan_inner
,
self
.inner
);
}
}
}
}
...
...
tests/cases/test_titan.rs
View file @
002ff06b
...
@@ -120,8 +120,8 @@ fn test_titandb() {
...
@@ -120,8 +120,8 @@ fn test_titandb() {
opts
.set_titandb_options
(
&
tdb_opts
);
opts
.set_titandb_options
(
&
tdb_opts
);
let
mut
cf_opts
=
ColumnFamilyOptions
::
new
();
let
mut
cf_opts
=
ColumnFamilyOptions
::
new
();
let
f
=
TitanCollectorFactory
::
default
();
let
f
=
TitanCollectorFactory
::
default
();
cf_opts
.add_table_properties_collector_factory
(
"titan-collector"
,
Box
::
new
(
f
));
cf_opts
.set_titandb_options
(
&
tdb_opts
);
cf_opts
.set_titandb_options
(
&
tdb_opts
);
cf_opts
.add_table_properties_collector_factory
(
"titan-collector"
,
Box
::
new
(
f
));
let
mut
db
=
DB
::
open_cf
(
let
mut
db
=
DB
::
open_cf
(
opts
,
opts
,
...
@@ -380,9 +380,9 @@ fn test_titan_statistics() {
...
@@ -380,9 +380,9 @@ fn test_titan_statistics() {
let
mut
tdb_opts
=
TitanDBOptions
::
new
();
let
mut
tdb_opts
=
TitanDBOptions
::
new
();
tdb_opts
.set_min_blob_size
(
0
);
tdb_opts
.set_min_blob_size
(
0
);
let
mut
opts
=
DBOptions
::
new
();
let
mut
opts
=
DBOptions
::
new
();
opts
.set_titandb_options
(
&
tdb_opts
);
opts
.enable_statistics
(
true
);
opts
.enable_statistics
(
true
);
opts
.create_if_missing
(
true
);
opts
.create_if_missing
(
true
);
opts
.set_titandb_options
(
&
tdb_opts
);
let
mut
cf_opts
=
ColumnFamilyOptions
::
new
();
let
mut
cf_opts
=
ColumnFamilyOptions
::
new
();
cf_opts
.set_titandb_options
(
&
tdb_opts
);
cf_opts
.set_titandb_options
(
&
tdb_opts
);
...
...
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