138b87eae4
Summary: Fixes the following scenario: 1. Set prefix extractor. Enable bloom filters, with `whole_key_filtering = false`. Use compaction filter that sometimes returns `kRemoveAndSkipUntil`. 2. Do a compaction. 3. Compaction creates an iterator with `total_order_seek = false`, calls `SeekToFirst()` on it, then repeatedly calls `Next()`. 4. At some point compaction filter returns `kRemoveAndSkipUntil`. 5. Compaction calls `Seek(skip_until)` on the iterator. The key that it seeks to happens to have prefix that doesn't match the bloom filter. Since `total_order_seek = false`, iterator becomes invalid, and compaction thinks that it has reached the end. The rest of the compaction input is silently discarded. The fix is to make compaction iterator use `total_order_seek = true`. The implementation for PlainTable is quite awkward. I've made `kRemoveAndSkipUntil` officially incompatible with PlainTable. If you try to use them together, compaction will fail, and DB will enter read-only mode (`bg_error_`). That's not a very graceful way to communicate a misconfiguration, but the alternatives don't seem worth the implementation time and complexity. To be able to check in advance that `kRemoveAndSkipUntil` is not going to be used with PlainTable, we'd need to extend the interface of either `CompactionFilter` or `InternalIterator`. It seems unlikely that anyone will ever want to use `kRemoveAndSkipUntil` with PlainTable: PlainTable probably has very few users, and `kRemoveAndSkipUntil` has only one user so far: us (logdevice). Closes https://github.com/facebook/rocksdb/pull/2349 Differential Revision: D5110388 Pulled By: lightmark fbshipit-source-id: ec29101a99d9dcd97db33923b87f72bce56cc17a |
||
---|---|---|
.. | ||
adaptive_table_factory.cc | ||
adaptive_table_factory.h | ||
block_based_filter_block_test.cc | ||
block_based_filter_block.cc | ||
block_based_filter_block.h | ||
block_based_table_builder.cc | ||
block_based_table_builder.h | ||
block_based_table_factory.cc | ||
block_based_table_factory.h | ||
block_based_table_reader.cc | ||
block_based_table_reader.h | ||
block_builder.cc | ||
block_builder.h | ||
block_prefix_index.cc | ||
block_prefix_index.h | ||
block_test.cc | ||
block.cc | ||
block.h | ||
bloom_block.cc | ||
bloom_block.h | ||
cleanable_test.cc | ||
cuckoo_table_builder_test.cc | ||
cuckoo_table_builder.cc | ||
cuckoo_table_builder.h | ||
cuckoo_table_factory.cc | ||
cuckoo_table_factory.h | ||
cuckoo_table_reader_test.cc | ||
cuckoo_table_reader.cc | ||
cuckoo_table_reader.h | ||
filter_block.h | ||
flush_block_policy.cc | ||
format.cc | ||
format.h | ||
full_filter_block_test.cc | ||
full_filter_block.cc | ||
full_filter_block.h | ||
get_context.cc | ||
get_context.h | ||
index_builder.cc | ||
index_builder.h | ||
internal_iterator.h | ||
iter_heap.h | ||
iterator_wrapper.h | ||
iterator.cc | ||
merger_test.cc | ||
merging_iterator.cc | ||
merging_iterator.h | ||
meta_blocks.cc | ||
meta_blocks.h | ||
mock_table.cc | ||
mock_table.h | ||
partitioned_filter_block_test.cc | ||
partitioned_filter_block.cc | ||
partitioned_filter_block.h | ||
persistent_cache_helper.cc | ||
persistent_cache_helper.h | ||
persistent_cache_options.h | ||
plain_table_builder.cc | ||
plain_table_builder.h | ||
plain_table_factory.cc | ||
plain_table_factory.h | ||
plain_table_index.cc | ||
plain_table_index.h | ||
plain_table_key_coding.cc | ||
plain_table_key_coding.h | ||
plain_table_reader.cc | ||
plain_table_reader.h | ||
scoped_arena_iterator.h | ||
sst_file_writer_collectors.h | ||
sst_file_writer.cc | ||
table_builder.h | ||
table_properties_internal.h | ||
table_properties.cc | ||
table_reader_bench.cc | ||
table_reader.h | ||
table_test.cc | ||
two_level_iterator.cc | ||
two_level_iterator.h |