diff --git a/db/view/view.cc b/db/view/view.cc index 545561c00d..e536665661 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -574,14 +574,16 @@ private: const bool _backing_secondary_index; public: - value_getter(const schema& base, const view_ptr& view, const partition_key& base_key, const clustering_or_static_row& update, const std::optional& existing) + value_getter(const schema& base, const view_ptr& view, const partition_key& base_key, const clustering_or_static_row& update, const std::optional& existing, bool backing_secondary_index) : _base(base) , _view(view) , _base_key(base_key) , _update(update) , _existing(existing) - , _backing_secondary_index(service::get_local_storage_proxy().local_db().find_column_family(_base.id()).get_index_manager().is_index(*_view)) - {} + , _backing_secondary_index(backing_secondary_index) + { + (void)_view; + } using vector_type = utils::small_vector; vector_type operator()(const column_definition& cdef) { @@ -649,7 +651,7 @@ private: std::vector view_updates::get_view_rows(const partition_key& base_key, const clustering_or_static_row& update, const std::optional& existing) { - value_getter getter(*_base, _view, base_key, update, existing); + value_getter getter(*_base, _view, base_key, update, existing, _backing_secondary_index); auto get_value = boost::adaptors::transformed(std::ref(getter)); @@ -1452,7 +1454,8 @@ view_update_builder make_view_update_builder( " base schema version of the view ({}) for view {}.{} of {}.{}", base->version(), v.base->base_schema()->version(), v.view->ks_name(), v.view->cf_name(), base->ks_name(), base->cf_name())); } - return view_updates(std::move(v)); + bool is_index = base_table.get_index_manager().is_index(v.view); + return view_updates(std::move(v), is_index); })); return view_update_builder(base_table, base, std::move(vs), std::move(updates), std::move(existings), now); } diff --git a/db/view/view.hh b/db/view/view.hh index 70ccd28bf1..a80e117102 100644 --- a/db/view/view.hh +++ b/db/view/view.hh @@ -209,13 +209,16 @@ class view_updates final { base_info_ptr _base_info; std::unordered_map _updates; mutable size_t _op_count = 0; + const bool _backing_secondary_index; public: - explicit view_updates(view_and_base vab) + explicit view_updates(view_and_base vab, bool backing_secondary_index) : _view(std::move(vab.view)) , _view_info(*_view->view_info()) , _base(vab.base->base_schema()) , _base_info(vab.base) - , _updates(8, partition_key::hashing(*_view), partition_key::equality(*_view)) { + , _updates(8, partition_key::hashing(*_view), partition_key::equality(*_view)) + , _backing_secondary_index(backing_secondary_index) + { } future<> move_to(utils::chunked_vector& mutations);