view_update_builder: Construct with data dictionary
The caller is table with view-update-generator at hand (it calls mutate_MV on). Builder here is used as a temporary object that destroys once the caller coroutine co_return-s, so keeping the database obtained from the view-update-generator is safe. Later the v.u.b. object will propagate its data dictionary down the callstacks. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -1439,6 +1439,7 @@ future<stop_iteration> view_update_builder::on_results() {
|
||||
}
|
||||
|
||||
view_update_builder make_view_update_builder(
|
||||
data_dictionary::database db,
|
||||
const replica::table& base_table,
|
||||
const schema_ptr& base,
|
||||
std::vector<view_and_base>&& views_to_update,
|
||||
@@ -1454,7 +1455,7 @@ view_update_builder make_view_update_builder(
|
||||
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);
|
||||
return view_update_builder(std::move(db), base_table, base, std::move(vs), std::move(updates), std::move(existings), now);
|
||||
}
|
||||
|
||||
future<query::clustering_row_ranges> calculate_affected_clustering_ranges(const schema& base,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "schema/schema_fwd.hh"
|
||||
#include "readers/flat_mutation_reader_v2.hh"
|
||||
#include "mutation/frozen_mutation.hh"
|
||||
#include "data_dictionary/data_dictionary.hh"
|
||||
|
||||
class frozen_mutation_and_schema;
|
||||
|
||||
@@ -244,6 +245,7 @@ private:
|
||||
};
|
||||
|
||||
class view_update_builder {
|
||||
data_dictionary::database _db;
|
||||
const replica::table& _base;
|
||||
schema_ptr _schema; // The base schema
|
||||
std::vector<view_updates> _view_updates;
|
||||
@@ -259,12 +261,13 @@ class view_update_builder {
|
||||
partition_key _key = partition_key::make_empty();
|
||||
public:
|
||||
|
||||
view_update_builder(const replica::table& base, schema_ptr s,
|
||||
view_update_builder(data_dictionary::database db, const replica::table& base, schema_ptr s,
|
||||
std::vector<view_updates>&& views_to_update,
|
||||
flat_mutation_reader_v2&& updates,
|
||||
flat_mutation_reader_v2_opt&& existings,
|
||||
gc_clock::time_point now)
|
||||
: _base(base)
|
||||
: _db(std::move(db))
|
||||
, _base(base)
|
||||
, _schema(std::move(s))
|
||||
, _view_updates(std::move(views_to_update))
|
||||
, _updates(std::move(updates))
|
||||
@@ -298,6 +301,7 @@ private:
|
||||
};
|
||||
|
||||
view_update_builder make_view_update_builder(
|
||||
data_dictionary::database db,
|
||||
const replica::table& base_table,
|
||||
const schema_ptr& base_schema,
|
||||
std::vector<view_and_base>&& views_to_update,
|
||||
|
||||
Reference in New Issue
Block a user