Make the options in table_builder/block_builder less misleading

Summary:
By original design, the regular `block options` and index `block options` in table_builder is mutable. We can use ChangeOptions to change the options directly.

However, with my last change, `BlockBuilder` no longer hold the reference to the index_block_options -- as a result, any changes made after the creation of index block builder will be of no effect.

But still the code is very error-prone and developers can easily fall into the trap without aware of it. To avoid this problem from happening in the future, I deleted the `ChangeOptions` and the `index_block_options`, as well as many other changes to make it less misleading.

Test Plan:
make
make check
make release

Reviewers: dhruba, haobo

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13707
This commit is contained in:
Kai Liu
2013-11-16 23:21:15 -08:00
parent f7a2b972a8
commit 7604e2f70c
5 changed files with 11 additions and 11 deletions

View File

@@ -217,7 +217,7 @@ class BlockConstructor: public Constructor {
virtual Status FinishImpl(const Options& options, const KVMap& data) {
delete block_;
block_ = nullptr;
BlockBuilder builder(&options);
BlockBuilder builder(options);
for (KVMap::const_iterator it = data.begin();
it != data.end();
@@ -832,7 +832,7 @@ TEST(TableTest, BasicTableStats) {
ASSERT_EQ("", stats.filter_policy_name); // no filter policy is used
// Verify data size.
BlockBuilder block_builder(&options);
BlockBuilder block_builder(options);
for (const auto& item : kvmap) {
block_builder.Add(item.first, item.second);
}