row_cache: Evict partition snapshots

If snapshots are not evicted, they may pin unbouned amount of memory
for a long time in cache, which may lead to OOM. Evict snapshots
together with the entry.

Fixes #2775.
Fixes #2730.
This commit is contained in:
Tomasz Grabiec
2017-09-07 20:05:14 +02:00
parent b6ae5783cd
commit c78047fa5b
2 changed files with 6 additions and 1 deletions

View File

@@ -854,7 +854,7 @@ future<> row_cache::update_invalidating(external_updater eu, memtable& m) {
// This invalidates all row ranges and the static row, leaving only the partition tombstone continuous,
// which has to always be continuous.
cache_entry& e = *cache_i;
e.partition() = partition_entry(mutation_partition::make_incomplete(*e.schema(), mem_e.partition().partition_tombstone()));
e.partition().evict(); // FIXME: evict gradually
} else {
_tracker.clear_continuity(*cache_i);
}
@@ -966,6 +966,10 @@ cache_entry::cache_entry(cache_entry&& o) noexcept
}
}
cache_entry::~cache_entry() {
_pe.evict();
}
void row_cache::set_schema(schema_ptr new_schema) noexcept {
_schema = std::move(new_schema);
}

View File

@@ -124,6 +124,7 @@ public:
}
cache_entry(cache_entry&&) noexcept;
~cache_entry();
bool is_evictable() { return _lru_link.is_linked(); }
const dht::decorated_key& key() const { return _key; }