From 70440f7a6341b96359292e93d77a4fe16f5e1f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=8F=E4=B9=8B=E7=AB=A0?= Date: Wed, 12 Jul 2017 16:49:56 -0700 Subject: [PATCH] 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 --- db/column_family.cc | 4 ++-- include/rocksdb/table.h | 3 +++ table/block_based_table_factory.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/db/column_family.cc b/db/column_family.cc index 5ad77ef0f..e32c65368 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -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, diff --git a/include/rocksdb/table.h b/include/rocksdb/table.h index 2590005f4..40e4d88b6 100644 --- a/include/rocksdb/table.h +++ b/include/rocksdb/table.h @@ -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 diff --git a/table/block_based_table_factory.h b/table/block_based_table_factory.h index 7ef91bedc..276d3d635 100644 --- a/table/block_based_table_factory.h +++ b/table/block_based_table_factory.h @@ -55,6 +55,8 @@ class BlockBasedTableFactory : public TableFactory { void* GetOptions() override { return &table_options_; } + bool IsDeleteRangeSupported() const override { return true; } + private: BlockBasedTableOptions table_options_; };