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
4838a968
Commit
4838a968
authored
Feb 28, 2018
by
zhangjinpeng1987
Committed by
Huachao Huang
Feb 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync wal before close (#189)
parent
f57f6731
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
rocksdb.rs
src/rocksdb.rs
+11
-0
No files found.
src/rocksdb.rs
View file @
4838a968
...
@@ -82,6 +82,7 @@ pub struct DB {
...
@@ -82,6 +82,7 @@ pub struct DB {
path
:
String
,
path
:
String
,
opts
:
DBOptions
,
opts
:
DBOptions
,
_cf_opts
:
Vec
<
ColumnFamilyOptions
>
,
_cf_opts
:
Vec
<
ColumnFamilyOptions
>
,
readonly
:
bool
,
}
}
impl
Debug
for
DB
{
impl
Debug
for
DB
{
...
@@ -433,6 +434,11 @@ impl DB {
...
@@ -433,6 +434,11 @@ impl DB {
.map
(|
x
|
x
.inner
as
*
const
crocksdb_ffi
::
Options
)
.map
(|
x
|
x
.inner
as
*
const
crocksdb_ffi
::
Options
)
.collect
();
.collect
();
let
readonly
=
if
error_if_log_file_exist
.is_some
()
{
true
}
else
{
false
};
let
db
=
{
let
db
=
{
let
db_options
=
opts
.inner
;
let
db_options
=
opts
.inner
;
let
db_path
=
cpath
.as_ptr
();
let
db_path
=
cpath
.as_ptr
();
...
@@ -484,6 +490,7 @@ impl DB {
...
@@ -484,6 +490,7 @@ impl DB {
path
:
path
.to_owned
(),
path
:
path
.to_owned
(),
opts
:
opts
,
opts
:
opts
,
_cf_opts
:
options
,
_cf_opts
:
options
,
readonly
:
readonly
,
})
})
}
}
...
@@ -1518,6 +1525,10 @@ impl Drop for WriteBatch {
...
@@ -1518,6 +1525,10 @@ impl Drop for WriteBatch {
impl
Drop
for
DB
{
impl
Drop
for
DB
{
fn
drop
(
&
mut
self
)
{
fn
drop
(
&
mut
self
)
{
// SyncWAL before call close.
if
!
self
.readonly
{
self
.sync_wal
()
.unwrap
();
}
unsafe
{
unsafe
{
self
.cfs
.clear
();
self
.cfs
.clear
();
crocksdb_ffi
::
crocksdb_close
(
self
.inner
);
crocksdb_ffi
::
crocksdb_close
(
self
.inner
);
...
...
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