rocksdb/examples
Marton Trencseni 522de4f59e Adding pin_l0_filter_and_index_blocks_in_cache feature.
Summary:
When a block based table file is opened, if prefetch_index_and_filter is true, it will prefetch the index and filter blocks, putting them into the block cache.
What this feature adds: when a L0 block based table file is opened, if pin_l0_filter_and_index_blocks_in_cache is true in the options (and prefetch_index_and_filter is true), then the filter and index blocks aren't released back to the block cache at the end of BlockBasedTableReader::Open(). Instead the table reader takes ownership of them, hence pinning them, ie. the LRU cache will never push them out. Meanwhile in the table reader, further accesses will not hit the block cache, thus avoiding lock contention.
When the table reader is destroyed, it releases the pinned blocks (if there were any). This has to happen before the cache is destroyed, so I had to introduce a TableReader::Close(), to guarantee the order of destruction.

Test Plan:
Added two unit tests for this. Existing unit tests run fine (default is pin_l0_filter_and_index_blocks_in_cache=false).

DISABLE_JEMALLOC=1 OPT=-g make all valgrind_check -j32
  Mac: OK.
  Linux: with D55287 patched in it's OK.

Reviewers: sdong

Reviewed By: sdong

Subscribers: andrewkr, leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D54801
2016-03-17 22:40:01 +00:00
..
.gitignore Compaction filter on merge operands 2015-10-07 09:30:03 -07:00
c_simple_example.c fix typo in c_simple_example 2015-05-22 16:13:11 -07:00
column_families_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
compact_files_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
compaction_filter_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
Makefile Fix examples 2015-12-16 17:04:46 +01:00
optimistic_transaction_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
options_file_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
README.md Improve examples/README.md 2015-12-16 16:27:37 +01:00
rocksdb_option_file_example.ini Adding pin_l0_filter_and_index_blocks_in_cache feature. 2016-03-17 22:40:01 +00:00
simple_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00
transaction_example.cc Updated all copyright headers to the new format. 2016-02-09 15:12:00 -08:00

  1. Compile RocksDB first by executing make static_lib in parent dir
  2. Compile all examples: cd examples/; make all