db/view: Consider cell liveness when generating updates

This patch ensures we take into account the liveness of the base's
regular column in the view's pk when generating view updates.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2017-05-05 20:53:30 +02:00
parent c421da6825
commit 1fd8b8e723

View File

@@ -443,11 +443,11 @@ void view_updates::generate_update(
}
auto* after = update.cells().find_cell(*col_id);
// Note: multi-cell columns can't be part of the primary key.
if (existing) {
auto* before = existing->cells().find_cell(*col_id);
if (before) {
if (after) {
// Note: multi-cell columns can't be part of the primary key.
if (before && before->as_atomic_cell().is_live()) {
if (after && after->as_atomic_cell().is_live()) {
auto cmp = compare_atomic_cell_for_merge(before->as_atomic_cell(), after->as_atomic_cell());
if (cmp == 0) {
update_entry(base_key, update, *existing, now);
@@ -462,7 +462,7 @@ void view_updates::generate_update(
}
// No existing row or the cell wasn't live
if (after) {
if (after && after->as_atomic_cell().is_live()) {
create_entry(base_key, update, now);
}
}