rocksdb/table
Feng Zhu 0af157f9bf Implement full filter for block based table.
Summary:
1. Make filter_block.h a base class. Derive block_based_filter_block and full_filter_block. The previous one is the traditional filter block. The full_filter_block is newly added. It would generate a filter block that contain all the keys in SST file.

2. When querying a key, table would first check if full_filter is available. If not, it would go to the exact data block and check using block_based filter.

3. User could choose to use full_filter or tradional(block_based_filter). They would be stored in SST file with different meta index name. "filter.filter_policy" or "full_filter.filter_policy". Then, Table reader is able to know the fllter block type.

4. Some optimizations have been done for full_filter_block, thus it requires a different interface compared to the original one in filter_policy.h.

5. Actual implementation of filter bits coding/decoding is placed in util/bloom_impl.cc

Benchmark: base commit 1d23b5c470
Command:
db_bench --db=/dev/shm/rocksdb --num_levels=6 --key_size=20 --prefix_size=20 --keys_per_prefix=0 --value_size=100 --write_buffer_size=134217728 --max_write_buffer_number=2 --target_file_size_base=33554432 --max_bytes_for_level_base=1073741824 --verify_checksum=false --max_background_compactions=4 --use_plain_table=0 --memtablerep=prefix_hash --open_files=-1 --mmap_read=1 --mmap_write=0 --bloom_bits=10 --bloom_locality=1 --memtable_bloom_bits=500000 --compression_type=lz4 --num=393216000 --use_hash_search=1 --block_size=1024 --block_restart_interval=16 --use_existing_db=1 --threads=1 --benchmarks=readrandom —disable_auto_compactions=1
Read QPS increase for about 30% from 2230002 to 2991411.

Test Plan:
make all check
valgrind db_test
db_stress --use_block_based_filter = 0
./auto_sanity_test.sh

Reviewers: igor, yhchiang, ljin, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D20979
2014-09-08 10:37:05 -07:00
..
adaptive_table_factory.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
adaptive_table_factory.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
block_based_filter_block_test.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
block_based_filter_block.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
block_based_filter_block.h Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
block_based_table_builder.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
block_based_table_builder.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
block_based_table_factory.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
block_based_table_factory.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
block_based_table_reader.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
block_based_table_reader.h Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
block_builder.cc Fix compile 2014-09-02 11:49:38 -07:00
block_builder.h delete unused Comparator 2014-09-04 09:10:13 +08:00
block_hash_index_test.cc Materialize the hash index 2014-05-15 14:09:03 -07:00
block_hash_index.cc Materialize the hash index 2014-05-15 14:09:03 -07:00
block_hash_index.h Materialize the hash index 2014-05-15 14:09:03 -07:00
block_prefix_index.cc fix a few compile warnings 2014-09-04 23:06:23 +08:00
block_prefix_index.h fix a few compile warnings 2014-09-04 23:06:23 +08:00
block_test.cc Fix compile 2014-09-02 11:49:38 -07:00
block.cc ReadOptions.total_order_seek to allow total order seek for block-based table when hash index is enabled 2014-08-25 16:14:30 -07:00
block.h ReadOptions.total_order_seek to allow total order seek for block-based table when hash index is enabled 2014-08-25 16:14:30 -07:00
bloom_block.cc Adding option to save PlainTable index and bloom filter in SST file. 2014-07-18 16:58:13 -07:00
bloom_block.h Adding option to save PlainTable index and bloom filter in SST file. 2014-07-18 16:58:13 -07:00
cuckoo_table_builder_test.cc Fix compaction bug in Cuckoo Table Builder. Use kvs_.size() instead of num_entries in FileSize() method. 2014-09-05 11:18:01 -07:00
cuckoo_table_builder.cc Fix compaction bug in Cuckoo Table Builder. Use kvs_.size() instead of num_entries in FileSize() method. 2014-09-05 11:18:01 -07:00
cuckoo_table_builder.h Improve Cuckoo Table Reader performance. Inlined hash function and number of buckets a power of two. 2014-08-29 19:06:15 -07:00
cuckoo_table_factory.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
cuckoo_table_factory.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
cuckoo_table_reader_test.cc fix more compile warnings 2014-09-05 14:14:37 +08:00
cuckoo_table_reader.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
cuckoo_table_reader.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
filter_block.h Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
flush_block_policy.cc move block based table related options BlockBasedTableOptions 2014-08-25 14:22:05 -07:00
format.cc Refactor PerfStepTimer to stop on destruct 2014-09-02 12:04:22 -07:00
format.h xxHash 2014-05-01 14:09:32 -04:00
full_filter_block_test.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
full_filter_block.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
full_filter_block.h Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
iter_heap.h Turn on -Wmissing-prototypes 2014-04-09 21:17:14 -07:00
iterator_wrapper.h In DB::NewIterator(), try to allocate the whole iterator tree in an arena 2014-06-02 17:44:57 -07:00
iterator.cc In DB::NewIterator(), try to allocate the whole iterator tree in an arena 2014-06-02 17:44:57 -07:00
merger.cc Refactor PerfStepTimer to stop on destruct 2014-09-02 12:04:22 -07:00
merger.h In DB::NewIterator(), try to allocate the whole iterator tree in an arena 2014-06-02 17:44:57 -07:00
meta_blocks.cc Fix compile 2014-09-02 11:49:38 -07:00
meta_blocks.h Adding option to save PlainTable index and bloom filter in SST file. 2014-07-18 16:58:13 -07:00
plain_table_builder.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
plain_table_builder.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
plain_table_factory.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
plain_table_factory.h fix comments 2014-09-08 16:34:04 +08:00
plain_table_index.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
plain_table_index.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
plain_table_key_coding.cc replace hard-coded number with named variable 2014-09-08 11:10:17 +08:00
plain_table_key_coding.h typo improvement 2014-09-06 23:21:26 +08:00
plain_table_reader.cc Implement full filter for block based table. 2014-09-08 10:37:05 -07:00
plain_table_reader.h introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
table_builder.h First phase API clean up 2014-02-03 00:30:43 -08:00
table_properties.cc Fix SIGFAULT when running sst_dump on v2.6 db 2014-04-21 17:49:47 -07:00
table_reader_bench.cc introduce ImmutableOptions 2014-09-04 16:18:36 -07:00
table_reader.h Add DB property "rocksdb.estimate-table-readers-mem" 2014-08-06 11:39:46 -07:00
table_test.cc Remove path with arena==nullptr from NewInternalIterator 2014-09-04 17:40:41 -07:00
two_level_iterator.cc ForwardIterator: reset incomplete iterators on Seek() 2014-08-29 16:21:29 -07:00
two_level_iterator.h In DB::NewIterator(), try to allocate the whole iterator tree in an arena 2014-06-02 17:44:57 -07:00