db/view/build_progress_virtual_reader: Fix full ck detection

As an optimization, the virtual reader doesn't change the underlying
key if it is not full, and hence doesn't include the extra clustering
key. However, this detection is broken because it checked for 3
clustering columns, instead of 2.

This patch fixes that by obtaining the clustering key size from the
underlying schema instead of hardcoding the size.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2018-07-11 23:24:30 +01:00
parent ff3a0d437a
commit eda6b88b0e

View File

@@ -101,12 +101,12 @@ class build_progress_virtual_reader {
}
clustering_key adjust_ckey(clustering_key& underlying_ck) {
if (underlying_ck.size(underlying_schema()) < 3) {
if (!underlying_ck.is_full(underlying_schema())) {
return std::move(underlying_ck);
}
// Drop the cpu_id from the clustering key
auto end = underlying_ck.begin(underlying_schema());
std::advance(end, 1);
std::advance(end, underlying_schema().clustering_key_size() - 1);
auto r = boost::make_iterator_range(underlying_ck.begin(underlying_schema()), std::move(end));
return clustering_key_prefix::from_exploded(r);
}