Use total charge in MaintainPoolSize (#5813)

Summary:
https://github.com/facebook/rocksdb/issues/5797 charges the block cache with the total of user-provided charge plus the metadata charge. It had a bug where in MaintainPoolSize the user-provided charge was used instead of the total charge. The patch fixes that.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5813

Differential Revision: D17412783

Pulled By: maysamyabandeh

fbshipit-source-id: 45c0ac9f1e2233760db5ccd61399605cd74edc87
This commit is contained in:
Maysam Yabandeh 2019-09-17 00:14:29 -07:00 committed by Facebook Github Bot
parent 6287f0d73b
commit 9a87ae46fd

6
cache/lru_cache.cc vendored
View File

@ -225,8 +225,10 @@ void LRUCacheShard::MaintainPoolSize() {
lru_low_pri_ = lru_low_pri_->next; lru_low_pri_ = lru_low_pri_->next;
assert(lru_low_pri_ != &lru_); assert(lru_low_pri_ != &lru_);
lru_low_pri_->SetInHighPriPool(false); lru_low_pri_->SetInHighPriPool(false);
assert(high_pri_pool_usage_ >= lru_low_pri_->charge); size_t total_charge =
high_pri_pool_usage_ -= lru_low_pri_->charge; lru_low_pri_->CalcTotalCharge(metadata_charge_policy_);
assert(high_pri_pool_usage_ >= total_charge);
high_pri_pool_usage_ -= total_charge;
} }
} }