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
028ef32c
Unverified
Commit
028ef32c
authored
Nov 15, 2019
by
Xinye Tao
Committed by
GitHub
Nov 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix db cleanup in blob_gc_job_test (#107)
Signed-off-by:
tabokie
<
xy.tao@outlook.com
>
parent
96922d49
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
+8
-22
blob_gc_job_test.cc
src/blob_gc_job_test.cc
+8
-22
No files found.
src/blob_gc_job_test.cc
View file @
028ef32c
...
...
@@ -41,7 +41,7 @@ class BlobGCJobTest : public testing::Test {
options_
.
env
->
CreateDirIfMissing
(
dbname_
);
options_
.
env
->
CreateDirIfMissing
(
options_
.
dirname
);
}
~
BlobGCJobTest
()
{}
~
BlobGCJobTest
()
{
Close
();
}
void
DisableMergeSmall
()
{
options_
.
merge_small_file_threshold
=
0
;
}
...
...
@@ -87,7 +87,7 @@ class BlobGCJobTest : public testing::Test {
}
void
Reopen
()
{
DestroyDB
();
Close
();
Open
();
}
...
...
@@ -119,9 +119,9 @@ class BlobGCJobTest : public testing::Test {
b
->
ComputeGCScore
();
}
void
DestroyDB
()
{
Status
s
__attribute__
((
__unused__
))
=
db_
->
Close
()
;
assert
(
s
.
ok
());
void
Close
()
{
if
(
!
db_
)
return
;
ASSERT_OK
(
db_
->
Close
());
delete
db_
;
db_
=
nullptr
;
}
...
...
@@ -220,7 +220,6 @@ class BlobGCJobTest : public testing::Test {
bool
discardable
=
false
;
ASSERT_OK
(
blob_gc_job
.
DiscardEntry
(
key
,
blob_index
,
&
discardable
));
ASSERT_FALSE
(
discardable
);
DestroyDB
();
}
void
TestRunGC
()
{
...
...
@@ -277,7 +276,6 @@ class BlobGCJobTest : public testing::Test {
}
delete
db_iter
;
ASSERT_FALSE
(
iter
->
Valid
()
||
!
iter
->
status
().
ok
());
DestroyDB
();
}
};
...
...
@@ -354,7 +352,7 @@ TEST_F(BlobGCJobTest, GCLimiter) {
RunGC
(
true
);
ASSERT_TRUE
(
test_limiter
->
WriteRequested
());
ASSERT_FALSE
(
test_limiter
->
ReadRequested
());
DestroyDB
();
Close
();
test_limiter
=
new
TestLimiter
(
RateLimiter
::
Mode
::
kReadsOnly
);
options_
.
rate_limiter
.
reset
(
test_limiter
);
...
...
@@ -364,7 +362,7 @@ TEST_F(BlobGCJobTest, GCLimiter) {
RunGC
(
true
);
ASSERT_FALSE
(
test_limiter
->
WriteRequested
());
ASSERT_TRUE
(
test_limiter
->
ReadRequested
());
DestroyDB
();
Close
();
test_limiter
=
new
TestLimiter
(
RateLimiter
::
Mode
::
kAllIo
);
options_
.
rate_limiter
.
reset
(
test_limiter
);
...
...
@@ -374,7 +372,7 @@ TEST_F(BlobGCJobTest, GCLimiter) {
RunGC
(
true
);
ASSERT_TRUE
(
test_limiter
->
WriteRequested
());
ASSERT_TRUE
(
test_limiter
->
ReadRequested
());
DestroyDB
();
Close
();
}
TEST_F
(
BlobGCJobTest
,
Reopen
)
{
...
...
@@ -397,8 +395,6 @@ TEST_F(BlobGCJobTest, Reopen) {
RunGC
(
false
,
true
);
CheckBlobNumber
(
1
);
DestroyDB
();
}
// Tests blob file will be kept after GC, if it is still visible by active
...
...
@@ -456,8 +452,6 @@ TEST_F(BlobGCJobTest, PurgeBlobs) {
RunGC
(
false
);
CheckBlobNumber
(
1
);
DestroyDB
();
}
TEST_F
(
BlobGCJobTest
,
DeleteFilesInRange
)
{
...
...
@@ -549,8 +543,6 @@ TEST_F(BlobGCJobTest, DeleteFilesInRange) {
}
ASSERT_OK
(
iter
->
status
());
delete
iter
;
DestroyDB
();
}
TEST_F
(
BlobGCJobTest
,
LevelMergeGC
)
{
...
...
@@ -602,8 +594,6 @@ TEST_F(BlobGCJobTest, LevelMergeGC) {
BlobFileMeta
::
FileState
::
kObsolete
);
ASSERT_EQ
(
b
->
FindFile
(
5
).
lock
()
->
file_state
(),
BlobFileMeta
::
FileState
::
kNormal
);
DestroyDB
();
}
TEST_F
(
BlobGCJobTest
,
RangeMergeScheduler
)
{
...
...
@@ -775,8 +765,6 @@ TEST_F(BlobGCJobTest, RangeMergeScheduler) {
files
[
i
]
->
FileStateTransit
(
BlobFileMeta
::
FileEvent
::
kReset
);
}
}
DestroyDB
();
}
TEST_F
(
BlobGCJobTest
,
RangeMerge
)
{
...
...
@@ -827,8 +815,6 @@ TEST_F(BlobGCJobTest, RangeMerge) {
auto
blob
=
b
->
FindFile
(
i
).
lock
();
ASSERT_EQ
(
blob
->
file_state
(),
BlobFileMeta
::
FileState
::
kObsolete
);
}
DestroyDB
();
}
}
// namespace titandb
...
...
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