secondary index: fix indexing of partition-key column

Indexing an only partition key component is not allowed (because it would
be redundant), but it should be allowed to index one of several partition
key components. We had a bug in that case: the underlying materialized view
we created had the same column as both a partition key and a clustering
key, which resulted in an assertion failure. This patch fixes that.

Fixes #3404.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20180501121544.22869-1-nyh@scylladb.com>
This commit is contained in:
Nadav Har'El
2018-05-01 15:15:42 +03:00
committed by Pekka Enberg
parent 21d7507b74
commit 79c6bb642f

View File

@@ -110,6 +110,9 @@ view_ptr secondary_index_manager::create_view_for_index(const index_metadata& im
}
builder.with_column(index_target->name(), index_target->type, column_kind::partition_key);
for (auto& col : schema->partition_key_columns()) {
if (col == *index_target) {
continue;
}
builder.with_column(col.name(), col.type, column_kind::clustering_key);
}
for (auto& col : schema->clustering_key_columns()) {