From ee2b1ec1e8776d6ed154f2d66435be8e2a620da5 Mon Sep 17 00:00:00 2001 From: raistlin Date: Fri, 20 Oct 2017 10:04:28 -0700 Subject: [PATCH] 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 --- cache/lru_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cache/lru_cache.cc b/cache/lru_cache.cc index d29e70934..5d21b6cdc 100644 --- a/cache/lru_cache.cc +++ b/cache/lru_cache.cc @@ -100,7 +100,7 @@ void LRUHandleTable::Resize() { } 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 lru_.next = &lru_; lru_.prev = &lru_;