From 82eb5611aba45f2245520f17eeecd99b1759b856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jadwiszczak?= Date: Mon, 18 May 2026 09:54:26 +0200 Subject: [PATCH 1/2] db/view_building_task_mutation_builder: add `empty()` method The method allows to check if the builder contains any changes, so it will allow to skip emitting empty mutation. --- db/view/view_building_task_mutation_builder.hh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/view/view_building_task_mutation_builder.hh b/db/view/view_building_task_mutation_builder.hh index b0d98312cb..80c1c3c970 100644 --- a/db/view/view_building_task_mutation_builder.hh +++ b/db/view/view_building_task_mutation_builder.hh @@ -52,6 +52,9 @@ public: mutation build() { return std::move(_m); } + bool empty() const { + return _m.partition().empty(); + } private: clustering_key get_ck(utils::UUID id); From a9b2baf36b865a20d70b3fdd9d48c5336b1754d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jadwiszczak?= Date: Thu, 14 May 2026 14:59:21 +0200 Subject: [PATCH 2/2] db/schema_tables: don't emit empty view_building_tasks mutation on ALTER TABLE After recent change (1a32ccd) `make_update_indices_mutations()` is unconditionally adding a mutation for `system.view_building_tasks`, even when no indices were being dropped. In a mixed-version cluster, the older node may not have this table, causing the Raft schema applier to fail with 'Can't find a column family with UUID ...'. This patch fixes the bug by emitting the mutation when indices are actually dropped (i.e., when the view building cleanup code path was entered). Fixes: SCYLLADB-2026 Refs: scylladb#26557 --- db/schema_tables.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/db/schema_tables.cc b/db/schema_tables.cc index b318bacda9..63db6d6e17 100644 --- a/db/schema_tables.cc +++ b/db/schema_tables.cc @@ -1863,8 +1863,12 @@ static void make_update_indices_mutations( } mutations.emplace_back(std::move(indices_mutation)); - mutations.emplace_back(vb_mut_builder.build()); - mutations.insert(mutations.end(), std::make_move_iterator(view_status_muts.begin()), std::make_move_iterator(view_status_muts.end())); + if (!vb_mut_builder.empty()) { + mutations.emplace_back(vb_mut_builder.build()); + } + if (!view_status_muts.empty()) { + mutations.insert(mutations.end(), std::make_move_iterator(view_status_muts.begin()), std::make_move_iterator(view_status_muts.end())); + } } static void add_drop_column_to_mutations(schema_ptr table, const sstring& name, const schema::dropped_column& dc, api::timestamp_type timestamp, utils::chunked_vector& mutations) {