db: add query option to bypass cache

With the option enabled, we bypass the cache unconditionally and only
read from memtables+sstables. This is useful for analytics queries.
This commit is contained in:
Avi Kivity
2018-11-25 16:26:08 +02:00
parent d18bbe9d45
commit b835b93ee6
2 changed files with 4 additions and 3 deletions

View File

@@ -675,7 +675,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) {
if (_config.enable_cache && !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));

View File

@@ -100,7 +100,7 @@ constexpr auto max_rows = std::numeric_limits<uint32_t>::max();
class partition_slice {
public:
enum class option { send_clustering_key, send_partition_key, send_timestamp, send_expiry, reversed, distinct, collections_as_maps, send_ttl,
allow_short_read, with_digest };
allow_short_read, with_digest, bypass_cache };
using option_set = enum_set<super_enum<option,
option::send_clustering_key,
option::send_partition_key,
@@ -111,7 +111,8 @@ public:
option::collections_as_maps,
option::send_ttl,
option::allow_short_read,
option::with_digest>>;
option::with_digest,
option::bypass_cache>>;
clustering_row_ranges _row_ranges;
public:
std::vector<column_id> static_columns; // TODO: consider using bitmap