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
28717a8b
Unverified
Commit
28717a8b
authored
Sep 17, 2020
by
Connor
Committed by
GitHub
Sep 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separate deleteblobfiles from deletefiles (#185)
Signed-off-by:
Connor1996
<
zbk602423539@gmail.com
>
parent
81814ece
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
5 deletions
+19
-5
db.h
include/titan/db.h
+4
-0
db_impl.cc
src/db_impl.cc
+10
-5
db_impl.h
src/db_impl.h
+4
-0
titan_db_test.cc
src/titan_db_test.cc
+1
-0
No files found.
include/titan/db.h
View file @
28717a8b
...
...
@@ -128,6 +128,10 @@ class TitanDB : public StackableDB {
const
RangePtr
*
ranges
,
size_t
n
,
bool
include_end
=
true
)
=
0
;
virtual
Status
DeleteBlobFilesInRanges
(
ColumnFamilyHandle
*
column_family
,
const
RangePtr
*
ranges
,
size_t
n
,
bool
include_end
=
true
)
=
0
;
using
rocksdb
::
StackableDB
::
GetOptions
;
Options
GetOptions
(
ColumnFamilyHandle
*
column_family
)
const
override
=
0
;
...
...
src/db_impl.cc
View file @
28717a8b
...
...
@@ -862,11 +862,6 @@ Status TitanDBImpl::DeleteFilesInRanges(ColumnFamilyHandle* column_family,
if
(
!
s
.
ok
())
return
s
;
MutexLock
l
(
&
mutex_
);
SequenceNumber
obsolete_sequence
=
db_impl_
->
GetLatestSequenceNumber
();
s
=
blob_file_set_
->
DeleteBlobFilesInRanges
(
cf_id
,
ranges
,
n
,
include_end
,
obsolete_sequence
);
if
(
!
s
.
ok
())
return
s
;
auto
bs
=
blob_file_set_
->
GetBlobStorage
(
cf_id
).
lock
();
if
(
!
bs
)
{
// TODO: Should treat it as background error and make DB read-only.
...
...
@@ -925,6 +920,16 @@ Status TitanDBImpl::DeleteFilesInRanges(ColumnFamilyHandle* column_family,
return
s
;
}
Status
TitanDBImpl
::
DeleteBlobFilesInRanges
(
ColumnFamilyHandle
*
column_family
,
const
RangePtr
*
ranges
,
size_t
n
,
bool
include_end
)
{
MutexLock
l
(
&
mutex_
);
SequenceNumber
obsolete_sequence
=
db_impl_
->
GetLatestSequenceNumber
();
Status
s
=
blob_file_set_
->
DeleteBlobFilesInRanges
(
column_family
->
GetID
(),
ranges
,
n
,
include_end
,
obsolete_sequence
);
return
s
;
}
void
TitanDBImpl
::
MarkFileIfNeedMerge
(
const
std
::
vector
<
std
::
shared_ptr
<
BlobFileMeta
>>&
files
,
int
max_sorted_runs
)
{
...
...
src/db_impl.h
View file @
28717a8b
...
...
@@ -114,6 +114,10 @@ class TitanDBImpl : public TitanDB {
const
RangePtr
*
ranges
,
size_t
n
,
bool
include_end
=
true
)
override
;
Status
DeleteBlobFilesInRanges
(
ColumnFamilyHandle
*
column_family
,
const
RangePtr
*
ranges
,
size_t
n
,
bool
include_end
=
true
)
override
;
using
TitanDB
::
GetOptions
;
Options
GetOptions
(
ColumnFamilyHandle
*
column_family
)
const
override
;
...
...
src/titan_db_test.cc
View file @
28717a8b
...
...
@@ -247,6 +247,7 @@ class TitanDBTest : public testing::Test {
void
DeleteFilesInRange
(
const
Slice
*
begin
,
const
Slice
*
end
)
{
RangePtr
range
(
begin
,
end
);
ASSERT_OK
(
db_
->
DeleteFilesInRanges
(
db_
->
DefaultColumnFamily
(),
&
range
,
1
));
ASSERT_OK
(
db_
->
DeleteBlobFilesInRanges
(
db_
->
DefaultColumnFamily
(),
&
range
,
1
));
}
std
::
string
GenKey
(
uint64_t
i
)
{
...
...
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