summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kryczka <andrewkr@fb.com>2020-10-12 12:42:58 -0700
committerAndrew Kryczka <andrewkr@fb.com>2020-10-12 13:14:45 -0700
commitf36f44c5e6e36595c71fc5c2a29f4a1bad6d474d (patch)
tree2b81723ffdad6e6e39bc869861e8cc76bb4048ec
parent8d70e531142200cd310820033c4e9838fba40f80 (diff)
Fix bug in pinned partitioned indexes with some reads bypassing block cache
Backports part of 75d3b6fdf0aa1007c4d26382f65be0adf4519a37.
-rw-r--r--HISTORY.md1
-rw-r--r--table/block_based/partitioned_index_reader.cc2
2 files changed, 2 insertions, 1 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 133a6d549..535d79542 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -2,6 +2,7 @@
## Unreleased
### Bug Fixes
* Fixed a bug in the following combination of features: indexes with user keys (`format_version >= 3`), indexes are partitioned (`index_type == kTwoLevelIndexSearch`), and some index partitions are pinned in memory (`BlockBasedTableOptions::pin_l0_filter_and_index_blocks_in_cache`). The bug could cause keys to be truncated when read from the index leading to wrong read results or other unexpected behavior.
+* Fixed a bug when indexes are partitioned (`index_type == kTwoLevelIndexSearch`), some index partitions are pinned in memory (`BlockBasedTableOptions::pin_l0_filter_and_index_blocks_in_cache`), and partitions reads could be mixed between block cache and directly from the file (e.g., with `enable_index_compression == 1` and `mmap_read == 1`, partitions that were stored uncompressed due to poor compression ratio would be read directly from the file via mmap, while partitions that were stored compressed would be read from block cache). The bug could cause index partitions to be mistakenly considered empty during reads leading to wrong read results.
## 6.11.5 (7/23/2020)
### Bug Fixes
diff --git a/table/block_based/partitioned_index_reader.cc b/table/block_based/partitioned_index_reader.cc
index d235f0080..245370d59 100644
--- a/table/block_based/partitioned_index_reader.cc
+++ b/table/block_based/partitioned_index_reader.cc
@@ -167,7 +167,7 @@ void PartitionIndexReader::CacheDependencies(bool pin) {
assert(s.ok() || block.GetValue() == nullptr);
if (s.ok() && block.GetValue() != nullptr) {
- if (block.IsCached()) {
+ if (block.IsCached() || block.GetOwnValue()) {
if (pin) {
partition_map_[handle.offset()] = std::move(block);
}