Fix for when block.cache_handle is nullptr
Summary: When using with compressed cache it is possible that the status is ok but the block is not actually added to the block cache. The patch takes this case into account. Closes https://github.com/facebook/rocksdb/pull/2945 Differential Revision: D5937613 Pulled By: maysamyabandeh fbshipit-source-id: 5428cf1115e5046b3d01ab78d26cb181122af4c6
This commit is contained in:
parent
5df172da2f
commit
ab0542f5ec
@ -259,13 +259,17 @@ class PartitionIndexReader : public IndexReader, public Cleanable {
|
||||
|
||||
assert(s.ok() || block.value == nullptr);
|
||||
if (s.ok() && block.value != nullptr) {
|
||||
assert(block.cache_handle != nullptr);
|
||||
if (block.cache_handle != nullptr) {
|
||||
if (pin) {
|
||||
partition_map_[handle.offset()] = block;
|
||||
RegisterCleanup(&ReleaseCachedEntry, block_cache, block.cache_handle);
|
||||
RegisterCleanup(&ReleaseCachedEntry, block_cache,
|
||||
block.cache_handle);
|
||||
} else {
|
||||
block_cache->Release(block.cache_handle);
|
||||
}
|
||||
} else {
|
||||
delete block.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user