Created
July 10, 2020 01:46
-
-
Save andrwng/c2f1b8066d4c50fded9f8bb2287e7895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/kudu/master/table_locations_cache.cc b/src/kudu/master/table_locations_cache.cc | |
index adf2a4a1a..a903889e3 100644 | |
--- a/src/kudu/master/table_locations_cache.cc | |
+++ b/src/kudu/master/table_locations_cache.cc | |
@@ -39,7 +39,7 @@ namespace kudu { | |
namespace master { | |
TableLocationsCache::TableLocationsCache(size_t capacity_bytes) | |
- : eviction_cb_(new EvictionCallback(this)), | |
+ : eviction_cb_(this), | |
cache_(NewCache<Cache::EvictionPolicy::LRU>(capacity_bytes, | |
"table-locations-cache")) { | |
} | |
@@ -88,7 +88,7 @@ TableLocationsCache::EntryHandle TableLocationsCache::Put( | |
Entry* entry = reinterpret_cast<Entry*>(cache_->MutableValue(&pending)); | |
entry->val_ptr = val.get(); | |
// Insert() evicts already existing entry with the same key, if any. | |
- auto h(cache_->Insert(std::move(pending), eviction_cb_.get())); | |
+ auto h(cache_->Insert(std::move(pending), &eviction_cb_)); | |
{ | |
std::lock_guard<simple_spinlock> l(keys_by_table_id_lock_); | |
keys_by_table_id_[table_id].emplace(key); | |
diff --git a/src/kudu/master/table_locations_cache.h b/src/kudu/master/table_locations_cache.h | |
index 5ec7cbc09..5dbec76a8 100644 | |
--- a/src/kudu/master/table_locations_cache.h | |
+++ b/src/kudu/master/table_locations_cache.h | |
@@ -142,7 +142,7 @@ class TableLocationsCache final { | |
// Invoked whenever a cached entry reaches zero reference count, i.e. it was | |
// removed from the cache and there aren't any other references | |
// floating around. | |
- std::unique_ptr<Cache::EvictionCallback> eviction_cb_; | |
+ EvictionCallback eviction_cb_; | |
// The underlying LRU cache instance. | |
std::unique_ptr<Cache> cache_; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment