Unverified Commit 46b3a5e4 authored by Connor's avatar Connor Committed by GitHub

Separate deleteblobfiles from deletefiles (#187)

* separate deleteblobfiles from deletefiles (#185)
Signed-off-by: 's avatarConnor1996 <zbk602423539@gmail.com>
parent 9df8f051
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -250,6 +250,8 @@ 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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment