api: Drop sstable index caches on system/drop_sstable_caches
This commit is contained in:
@@ -1334,6 +1334,11 @@ database::drop_caches() const {
|
||||
for (auto&& e : tables) {
|
||||
table& t = *e.second;
|
||||
co_await t.get_row_cache().invalidate(row_cache::external_updater([] {}));
|
||||
|
||||
auto sstables = t.get_sstables();
|
||||
for (sstables::shared_sstable sst : *sstables) {
|
||||
co_await sst->drop_caches();
|
||||
}
|
||||
}
|
||||
co_return;
|
||||
}
|
||||
|
||||
@@ -1396,6 +1396,12 @@ future<> sstable::create_data() noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
future<> sstable::drop_caches() {
|
||||
return _cached_index_file->evict_gently().then([this] {
|
||||
return _index_cache->evict_gently();
|
||||
});
|
||||
}
|
||||
|
||||
future<> sstable::read_filter(const io_priority_class& pc) {
|
||||
if (!has_component(component_type::Filter)) {
|
||||
_components->filter = std::make_unique<utils::filter::always_present_filter>();
|
||||
|
||||
@@ -815,6 +815,9 @@ public:
|
||||
return _origin;
|
||||
}
|
||||
|
||||
// Drops all evictable in-memory caches of on-disk content.
|
||||
future<> drop_caches();
|
||||
|
||||
// Allow the test cases from sstable_test.cc to test private methods. We use
|
||||
// a placeholder to avoid cluttering this class too much. The sstable_test class
|
||||
// will then re-export as public every method it needs.
|
||||
|
||||
Reference in New Issue
Block a user