mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
table: Add cache_enabled member function
This function determines cache usage based both on table _config and dynamic schema information. Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
This commit is contained in:
@@ -574,6 +574,9 @@ public:
|
||||
_is_bootstrap_or_replace = false;
|
||||
}
|
||||
private:
|
||||
bool cache_enabled() const {
|
||||
return _config.enable_cache && _schema->caching_options().enabled();
|
||||
}
|
||||
void update_stats_for_new_sstable(uint64_t disk_space_used_by_sstable, const std::vector<unsigned>& shards_for_the_sstable) noexcept;
|
||||
// Adds new sstable to the set of sstables
|
||||
// Doesn't update the cache. The cache must be synchronized in order for reads to see
|
||||
|
||||
6
table.cc
6
table.cc
@@ -469,7 +469,7 @@ table::make_reader(schema_ptr s,
|
||||
readers.emplace_back(mt->make_flat_reader(s, range, slice, pc, trace_state, fwd, fwd_mr));
|
||||
}
|
||||
|
||||
if (_config.enable_cache && !slice.options.contains(query::partition_slice::option::bypass_cache)) {
|
||||
if (cache_enabled() && !slice.options.contains(query::partition_slice::option::bypass_cache)) {
|
||||
readers.emplace_back(_cache.make_reader(s, range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
} else {
|
||||
readers.emplace_back(make_sstable_reader(s, _sstables, range, slice, pc, std::move(trace_state), fwd, fwd_mr));
|
||||
@@ -720,7 +720,7 @@ table::update_cache(lw_shared_ptr<memtable> m, sstables::shared_sstable sst) {
|
||||
m->mark_flushed(std::move(newtab_ms));
|
||||
try_trigger_compaction();
|
||||
};
|
||||
if (_config.enable_cache) {
|
||||
if (cache_enabled()) {
|
||||
return _cache.update(adder, *m);
|
||||
} else {
|
||||
adder();
|
||||
@@ -841,7 +841,7 @@ table::seal_active_streaming_memtable_immediate(flush_permit&& permit) {
|
||||
try_trigger_compaction();
|
||||
tlogger.debug("Flushing to {} done", newtab->get_filename());
|
||||
};
|
||||
if (_config.enable_cache) {
|
||||
if (cache_enabled()) {
|
||||
return _cache.update_invalidating(adder, *old);
|
||||
} else {
|
||||
adder();
|
||||
|
||||
Reference in New Issue
Block a user