db/view: Replace entry if cells don't match

If a base table regular columns is part of the view's pk, and if that
column changes, we should replace the entry, by deleting the row(s)
with the old value and inserting a new one.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2017-03-09 15:10:37 +01:00
parent f41a5e554d
commit ec681060a8

View File

@@ -425,9 +425,9 @@ void view_updates::generate_update(
// Note: multi-cell columns can't be part of the primary key.
auto cmp = compare_atomic_cell_for_merge(before->as_atomic_cell(), after->as_atomic_cell());
if (cmp == 0) {
replace_entry(base_key, update, *existing, now);
} else {
update_entry(base_key, update, *existing, now);
} else {
replace_entry(base_key, update, *existing, now);
}
} else {
delete_old_entry(base_key, *existing, now);