Fix unstable floating point exception

Summary:
Fix unstable floating point exception, tested on Windows, 64-bit build.
The problem appeared in `SetCapacity()` method at line

`high_pri_pool_capacity_ = capacity_ * high_pri_pool_ratio_;`

`high_pri_pool_ratio_` was not initialized at that moment, because
`SetHighPriorityPoolRatio()` is called after `SetCapacity()`. So,
`high_pri_pool_ratio_` contained garbage, which caused "Floating point
exception" sometimes.
Closes https://github.com/facebook/rocksdb/pull/3052

Differential Revision: D6111161

Pulled By: yiwu-arbug

fbshipit-source-id: d170329111ad12b4bf9bbcf37bcb6411523438ae
main
raistlin 7 years ago committed by Facebook Github Bot
parent f0804db7f7
commit ee2b1ec1e8
  1. 2
      cache/lru_cache.cc

@ -100,7 +100,7 @@ void LRUHandleTable::Resize() {
} }
LRUCacheShard::LRUCacheShard() LRUCacheShard::LRUCacheShard()
: high_pri_pool_usage_(0), usage_(0), lru_usage_(0) { : high_pri_pool_usage_(0), high_pri_pool_ratio_(0), usage_(0), lru_usage_(0) {
// Make empty circular linked list // Make empty circular linked list
lru_.next = &lru_; lru_.next = &lru_;
lru_.prev = &lru_; lru_.prev = &lru_;

Loading…
Cancel
Save