Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
titan
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
titan
Commits
cb67cd56
Unverified
Commit
cb67cd56
authored
Sep 22, 2019
by
Connor
Committed by
GitHub
Sep 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix wrong property after restart (#82)
Signed-off-by:
Connor1996
<
zbk602423539@gmail.com
>
parent
c6e408c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
db_impl.cc
src/db_impl.cc
+4
-3
titan_db_test.cc
src/titan_db_test.cc
+20
-0
No files found.
src/db_impl.cc
View file @
cb67cd56
...
...
@@ -256,6 +256,10 @@ Status TitanDBImpl::Open(const std::vector<TitanCFDescriptor>& descs,
}
if
(
!
s
.
ok
())
return
s
;
if
(
stats_
.
get
())
{
stats_
->
Initialize
(
column_families
);
}
s
=
blob_file_set_
->
Open
(
column_families
);
if
(
!
s
.
ok
())
return
s
;
...
...
@@ -268,9 +272,6 @@ Status TitanDBImpl::Open(const std::vector<TitanCFDescriptor>& descs,
s
=
DB
::
Open
(
db_options_
,
dbname_
,
base_descs
,
handles
,
&
db_
);
if
(
s
.
ok
())
{
db_impl_
=
reinterpret_cast
<
DBImpl
*>
(
db_
->
GetRootDB
());
if
(
stats_
.
get
())
{
stats_
->
Initialize
(
column_families
);
}
ROCKS_LOG_INFO
(
db_options_
.
info_log
,
"Titan DB open."
);
ROCKS_LOG_HEADER
(
db_options_
.
info_log
,
"Titan git sha: %s"
,
titan_build_git_sha
);
...
...
src/titan_db_test.cc
View file @
cb67cd56
...
...
@@ -13,6 +13,7 @@
#include "blob_file_size_collector.h"
#include "db_impl.h"
#include "db_iter.h"
#include "monitoring/statistics.h"
#include "titan/db.h"
#include "titan_fault_injection_test_env.h"
...
...
@@ -38,6 +39,7 @@ class TitanDBTest : public testing::Test {
options_
.
merge_small_file_threshold
=
0
;
options_
.
disable_background_gc
=
true
;
options_
.
blob_file_compression
=
CompressionType
::
kLZ4Compression
;
options_
.
statistics
=
CreateDBStatistics
();
DeleteDir
(
env_
,
options_
.
dirname
);
DeleteDir
(
env_
,
dbname_
);
}
...
...
@@ -129,6 +131,10 @@ class TitanDBTest : public testing::Test {
}
}
bool
GetIntProperty
(
const
Slice
&
property
,
uint64_t
*
value
)
{
return
db_
->
GetIntProperty
(
property
,
value
);
}
std
::
weak_ptr
<
BlobStorage
>
GetBlobStorage
(
ColumnFamilyHandle
*
cf_handle
=
nullptr
)
{
if
(
cf_handle
==
nullptr
)
{
...
...
@@ -367,6 +373,20 @@ TEST_F(TitanDBTest, DBIterSeek) {
}
}
TEST_F
(
TitanDBTest
,
GetProperty
)
{
Open
();
for
(
uint64_t
k
=
1
;
k
<=
100
;
k
++
)
{
Put
(
k
);
}
Flush
();
uint64_t
value
;
ASSERT_TRUE
(
GetIntProperty
(
TitanDB
::
Properties
::
kNumLiveBlobFile
,
&
value
));
ASSERT_EQ
(
value
,
1
);
Reopen
();
ASSERT_TRUE
(
GetIntProperty
(
TitanDB
::
Properties
::
kNumLiveBlobFile
,
&
value
));
ASSERT_EQ
(
value
,
1
);
}
TEST_F
(
TitanDBTest
,
Snapshot
)
{
Open
();
std
::
map
<
std
::
string
,
std
::
string
>
data
;
...
...
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