From 00be36e08fc1867dc87bab36cdd68474b81292f7 Mon Sep 17 00:00:00 2001 From: Wojciech Mitros Date: Wed, 15 Apr 2026 18:50:18 +0200 Subject: [PATCH] mv: avoid unnecessary copies of existing rows in generate_updates() In the existing-only tail block of generate_updates(), the clustering row and static row were extracted from the fragment using a deep copy constructor (e.g. clustering_row(*_schema, fragment.as_clustering_row())) even though the fragment is not used afterwards. Replace with moves, matching the pattern used in all other cases. --- db/view/view.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/view/view.cc b/db/view/view.cc index 0a2298e79a..a17509a0a2 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -1584,12 +1584,12 @@ future view_update_builder::generate_updates() { if (_existing_fragment->is_range_tombstone_change()) { _existing_current_tombstone = _existing_fragment->as_range_tombstone_change().tombstone(); } else if (_existing_fragment->is_clustering_row()) { - auto existing = clustering_row(*_schema, _existing_fragment->as_clustering_row()); + auto existing = std::move(*_existing_fragment).as_clustering_row(); existing.apply(std::max(_existing_partition_tombstone, _existing_current_tombstone)); auto update = clustering_row(existing.key(), row_tombstone(std::move(tombstone)), row_marker(), ::row()); generate_update(std::move(update), { std::move(existing) }); } else if (_existing_fragment->is_static_row()) { - auto existing = static_row(*_schema, _existing_fragment->as_static_row()); + auto existing = std::move(*_existing_fragment).as_static_row(); auto update = static_row(); generate_update(std::move(update), _update_partition_tombstone, { std::move(existing) }, _existing_partition_tombstone); }