提交 d74c9f0a 编写于 作者: V Venkatesh Radhakrishnan

DeleteFilesInRange: Clean job context if no files deleted

Summary:
We need to clean the job context if we end up not deleting any
files because no files are in the range specified.

Test Plan: DBCompactionTest.DeleteFileRange

Reviewers: sdong, anthony, yhchiang, kradhakrishnan, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D52467
上级 1dec5b8f
......@@ -1230,6 +1230,13 @@ TEST_F(DBCompactionTest, DeleteFileRange) {
}
}
ASSERT_GT(deleted_count, 0);
begin_string = Key(5000);
end_string = Key(6000);
Slice begin1(begin_string);
Slice end1(end_string);
// Try deleting files in range which contain no keys
ASSERT_OK(
DeleteFilesInRange(db_, db_->DefaultColumnFamily(), &begin1, &end1));
ASSERT_OK(
DeleteFilesInRange(db_, db_->DefaultColumnFamily(), nullptr, nullptr));
......
......@@ -5056,6 +5056,7 @@ Status DBImpl::DeleteFilesInRange(ColumnFamilyHandle* column_family,
}
}
if (edit.GetDeletedFiles().empty()) {
job_context.Clean();
return Status::OK();
}
status = versions_->LogAndApply(cfd, *cfd->GetLatestMutableCFOptions(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册