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
This commit is contained in:
Zhongyi Xie 2017-09-29 20:25:31 -07:00 committed by Facebook Github Bot
parent 2b22baf304
commit 593d3de371
2 changed files with 5 additions and 3 deletions

View File

@ -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),

View File

@ -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) {