Make NewBloomFilterPolicy() use full filter by default (#4735)

Summary:
Full block (use_block_based_builder=false) Bloom filter has clear CPU saving benefits but with limitation of using temp memory when building an SST file proportional to the SST file size. We reduced the chance of having large SST files with multi-level universal compaction. Now we change to a default with better performance.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4735

Differential Revision: D13266674

Pulled By: siying

fbshipit-source-id: 7594a4c3e32568a5a2adce22bb0e46553e55c602
main
Siying Dong 6 years ago committed by Facebook Github Bot
parent b0f3d9b478
commit 6e938c904f
  1. 1
      HISTORY.md
  2. 2
      db/db_block_cache_test.cc
  3. 4
      include/rocksdb/filter_policy.h

@ -8,6 +8,7 @@
### Bug Fixes ### Bug Fixes
* Fixed Get correctness bug in the presence of range tombstones where merge operands covered by a range tombstone always result in NotFound. * Fixed Get correctness bug in the presence of range tombstones where merge operands covered by a range tombstone always result in NotFound.
* Start populating `NO_FILE_CLOSES` ticker statistic, which was always zero previously. * Start populating `NO_FILE_CLOSES` ticker statistic, which was always zero previously.
* The default value of NewBloomFilterPolicy()'s argument use_block_based_builder is changed to false. Note that this new default may cause large temp memory usage when building very large SST files.
## 5.18.0 (11/12/2018) ## 5.18.0 (11/12/2018)
### New Features ### New Features

@ -349,7 +349,7 @@ TEST_F(DBBlockCacheTest, IndexAndFilterBlocksStats) {
// 200 bytes are enough to hold the first two blocks // 200 bytes are enough to hold the first two blocks
std::shared_ptr<Cache> cache = NewLRUCache(200, 0, false); std::shared_ptr<Cache> cache = NewLRUCache(200, 0, false);
table_options.block_cache = cache; table_options.block_cache = cache;
table_options.filter_policy.reset(NewBloomFilterPolicy(20)); table_options.filter_policy.reset(NewBloomFilterPolicy(20, true));
options.table_factory.reset(new BlockBasedTableFactory(table_options)); options.table_factory.reset(new BlockBasedTableFactory(table_options));
CreateAndReopenWithCF({"pikachu"}, options); CreateAndReopenWithCF({"pikachu"}, options);

@ -145,6 +145,6 @@ class FilterPolicy {
// ignores trailing spaces, it would be incorrect to use a // ignores trailing spaces, it would be incorrect to use a
// FilterPolicy (like NewBloomFilterPolicy) that does not ignore // FilterPolicy (like NewBloomFilterPolicy) that does not ignore
// trailing spaces in keys. // trailing spaces in keys.
extern const FilterPolicy* NewBloomFilterPolicy(int bits_per_key, extern const FilterPolicy* NewBloomFilterPolicy(
bool use_block_based_builder = true); int bits_per_key, bool use_block_based_builder = false);
} }

Loading…
Cancel
Save