Provide mechanism to configure when to flush the block

Summary: Allow block based table to configure the way flushing the blocks. This feature will allow us to add support for prefix-aligned block.

Test Plan: make check

Reviewers: dhruba, haobo, sdong, igor

Reviewed By: sdong

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13875
This commit is contained in:
Kai Liu
2013-11-07 21:27:21 -08:00
parent bba6595b1f
commit fd075d6edd
8 changed files with 230 additions and 64 deletions

View File

@@ -214,6 +214,10 @@ Options SanitizeOptions(const std::string& dbname,
std::make_shared<InternalKeyStatsCollector>()
);
if (!result.flush_block_policy_factory) {
result.SetUpDefaultFlushBlockPolicyFactory();
}
return result;
}

View File

@@ -83,10 +83,13 @@ class DumbLogger : public Logger {
// Utilities test functions
void MakeBuilder(
const Options& options,
Options options,
std::unique_ptr<FakeWritableFile>* writable,
std::unique_ptr<TableBuilder>* builder) {
writable->reset(new FakeWritableFile);
if (!options.flush_block_policy_factory) {
options.SetUpDefaultFlushBlockPolicyFactory();
}
builder->reset(
options.table_factory->GetTableBuilder(options, writable->get(),
options.compression));