From 593d3de37171d99a761ce2ab34ffa12654acd055 Mon Sep 17 00:00:00 2001 From: Zhongyi Xie Date: Fri, 29 Sep 2017 20:25:31 -0700 Subject: [PATCH] No need for Restart Interval for meta blocks Summary: In SST files, restart interval helps us search in data blocks. However, some meta blocks will be read sequentially, so there's no need for restart points. Restart interval will introduce extra space in the block (https://github.com/facebook/rocksdb/blob/master/table/block_builder.cc#L80). We will see if we can remove this redundant space. (Maybe set restart interval to infinite.) Closes https://github.com/facebook/rocksdb/pull/2940 Differential Revision: D5930139 Pulled By: miasantreble fbshipit-source-id: 92b1b23c15cffa90378343ac846b713623b19c21 --- table/block_based_table_builder.cc | 2 +- table/meta_blocks.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/table/block_based_table_builder.cc b/table/block_based_table_builder.cc index d42e0f8b7..d356cb5c0 100644 --- a/table/block_based_table_builder.cc +++ b/table/block_based_table_builder.cc @@ -295,7 +295,7 @@ struct BlockBasedTableBuilder::Rep { file(f), data_block(table_options.block_restart_interval, table_options.use_delta_encoding), - range_del_block(1), // TODO(andrewkr): restart_interval unnecessary + range_del_block(port::kMaxInt32), internal_prefix_transform(_ioptions.prefix_extractor), compression_type(_compression_type), compression_opts(_compression_opts), diff --git a/table/meta_blocks.cc b/table/meta_blocks.cc index 1227bb0ae..f8ea933f1 100644 --- a/table/meta_blocks.cc +++ b/table/meta_blocks.cc @@ -21,7 +21,8 @@ namespace rocksdb { MetaIndexBuilder::MetaIndexBuilder() - : meta_index_block_(new BlockBuilder(1 /* restart interval */)) {} + : meta_index_block_( + new BlockBuilder(port::kMaxInt32 /* restart interval */)) {} void MetaIndexBuilder::Add(const std::string& key, const BlockHandle& handle) { @@ -38,7 +39,8 @@ Slice MetaIndexBuilder::Finish() { } PropertyBlockBuilder::PropertyBlockBuilder() - : properties_block_(new BlockBuilder(1 /* restart interval */)) {} + : properties_block_( + new BlockBuilder(port::kMaxInt32 /* restart interval */)) {} void PropertyBlockBuilder::Add(const std::string& name, const std::string& val) {