Add the correct table_factory for tables in table_tests

This commit is contained in:
Kai Liu 2013-11-12 23:54:31 -08:00
parent 88ba331c1a
commit 80bb81c6fe
2 changed files with 7 additions and 2 deletions

View File

@ -543,6 +543,7 @@ class Harness {
// Use shorter block size for tests to exercise block boundary
// conditions more.
options_.block_size = 256;
options_.SetUpDefaultFlushBlockPolicyFactory();
if (args.reverse_compare) {
options_.comparator = &reverse_key_comparator;
}
@ -909,6 +910,8 @@ TEST(TableTest, NumBlockStat) {
options.compression = kNoCompression;
options.block_restart_interval = 1;
options.block_size = 1000;
options.SetUpDefaultFlushBlockPolicyFactory();
// Block Size changed, need to set up a new flush policy to reflect the
// change.
options.SetUpDefaultFlushBlockPolicyFactory();
@ -976,7 +979,7 @@ class BlockCacheStats {
TEST(TableTest, BlockCacheTest) {
// -- Table construction
Options options;
Options options = GetDefaultOptions();
options.create_if_missing = true;
options.statistics = CreateDBStatistics();
options.block_cache = NewLRUCache(1024);
@ -1116,6 +1119,7 @@ TEST(TableTest, ApproximateOffsetOfPlain) {
KVMap kvmap;
Options options = GetDefaultOptions();
options.block_size = 1024;
options.SetUpDefaultFlushBlockPolicyFactory();
options.compression = kNoCompression;
c.Finish(options, &keys, &kvmap);
@ -1145,6 +1149,7 @@ static void Do_Compression_Test(CompressionType comp) {
KVMap kvmap;
Options options = GetDefaultOptions();
options.block_size = 1024;
options.SetUpDefaultFlushBlockPolicyFactory();
options.compression = comp;
c.Finish(options, &keys, &kvmap);
@ -1187,6 +1192,7 @@ TEST(TableTest, BlockCacheLeak) {
Options opt = GetDefaultOptions();
opt.block_size = 1024;
opt.SetUpDefaultFlushBlockPolicyFactory();
opt.compression = kNoCompression;
opt.block_cache = NewLRUCache(16*1024*1024); // big enough so we don't ever
// lose cached values.

View File

@ -332,7 +332,6 @@ Options::PrepareForBulkLoad()
}
Options* Options::SetUpDefaultFlushBlockPolicyFactory() {
assert(!flush_block_policy_factory);
flush_block_policy_factory =
std::make_shared<FlushBlockBySizePolicyFactory>(
block_size, block_size_deviation);