Fix cache_tracker::clear

Make sure that artificial entries for
all column families are set to non continuous.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
Message-Id: <f9e517fe40482c05f6c388faab7d6b9eca6b159e.1467103548.git.piotr@scylladb.com>
This commit is contained in:
Piotr Jastrzebski
2016-06-28 10:46:05 +02:00
committed by Tomasz Grabiec
parent 27575a0528
commit 59d0d9e666
2 changed files with 12 additions and 10 deletions

View File

@@ -131,17 +131,18 @@ cache_tracker::setup_collectd() {
}
void cache_tracker::clear() {
if (!_lru.empty()) {
cache_entry& ce = _lru.back();
// Find _partitions.begin()
auto it = row_cache::partitions_type::s_iterator_to(ce);
while (it->key().relation_to_keys() != -1) {
--it;
}
it->set_continuous(false);
}
with_allocator(_region.allocator(), [this] {
_lru.clear_and_dispose(current_deleter<cache_entry>());
while (!_lru.empty()) {
cache_entry& ce = _lru.back();
auto it = row_cache::partitions_type::s_iterator_to(ce);
while (it->is_evictable()) {
cache_entry& to_remove = *it;
--it;
_lru.erase(_lru.iterator_to(to_remove));
current_deleter<cache_entry>()(&to_remove);
}
it->set_continuous(false);
}
});
_removals += _partitions;
_partitions = 0;

View File

@@ -100,6 +100,7 @@ public:
cache_entry(cache_entry&&) noexcept;
bool is_evictable() { return _lru_link.is_linked(); }
const dht::ring_position& key() const { return _key; }
const partition_entry& partition() const { return _pe; }
partition_entry& partition() { return _pe; }