Add virtual func IsDeleteRangeSupported

Summary:
this modify allows third-party tables able to support delete range
Closes https://github.com/facebook/rocksdb/pull/2035

Differential Revision: D5407973

Pulled By: ajkr

fbshipit-source-id: 82e364b7dd5a198660788d59543f15b8f95cc418
This commit is contained in:
奏之章 2017-07-12 16:49:56 -07:00 committed by Facebook Github Bot
parent 7550255c54
commit 70440f7a63
3 changed files with 7 additions and 2 deletions

View file

@ -355,8 +355,8 @@ ColumnFamilyData::ColumnFamilyData(
initial_cf_options_(SanitizeOptions(db_options, cf_options)),
ioptions_(db_options, initial_cf_options_),
mutable_cf_options_(initial_cf_options_),
is_delete_range_supported_(strcmp(cf_options.table_factory->Name(),
BlockBasedTableFactory().Name()) == 0),
is_delete_range_supported_(
cf_options.table_factory->IsDeleteRangeSupported()),
write_buffer_manager_(write_buffer_manager),
mem_(nullptr),
imm_(ioptions_.min_write_buffer_number_to_merge,

View file

@ -482,6 +482,9 @@ class TableFactory {
// Developers should use DB::SetOption() instead to dynamically change
// options while the DB is open.
virtual void* GetOptions() { return nullptr; }
// Return is delete range supported
virtual bool IsDeleteRangeSupported() const { return false; }
};
#ifndef ROCKSDB_LITE

View file

@ -55,6 +55,8 @@ class BlockBasedTableFactory : public TableFactory {
void* GetOptions() override { return &table_options_; }
bool IsDeleteRangeSupported() const override { return true; }
private:
BlockBasedTableOptions table_options_;
};