db/tags: drop unsafe update_tags() utility function
The previous patches introduced the function modify_tags() as a safe version of update_tags(), and switched all uses of update_tags() to use modify_tags(). So now that the unsafe update_tags() is no longer use, we can drop it. Signed-off-by: Nadav Har'El <nyh@scylladb.com>
This commit is contained in:
@@ -40,21 +40,6 @@ std::optional<std::string> find_tag(const schema& s, const sstring& tag) {
|
||||
}
|
||||
}
|
||||
|
||||
future<> update_tags(service::migration_manager& mm, schema_ptr schema, std::map<sstring, sstring>&& tags_map) {
|
||||
co_await mm.container().invoke_on(0, [s = global_schema_ptr(std::move(schema)), tags_map = std::move(tags_map)] (service::migration_manager& mm) -> future<> {
|
||||
// FIXME: the following needs to be in a loop. If mm.announce() below
|
||||
// fails, we need to retry the whole thing.
|
||||
auto group0_guard = co_await mm.start_group0_operation();
|
||||
|
||||
schema_builder builder(s);
|
||||
builder.add_extension(tags_extension::NAME, ::make_shared<tags_extension>(tags_map));
|
||||
|
||||
auto m = co_await mm.prepare_column_family_update_announcement(builder.build(), false, std::vector<view_ptr>(), group0_guard.write_timestamp());
|
||||
|
||||
co_await mm.announce(std::move(m), std::move(group0_guard));
|
||||
});
|
||||
}
|
||||
|
||||
future<> modify_tags(service::migration_manager& mm, sstring ks, sstring cf,
|
||||
std::function<void(std::map<sstring, sstring>&)> modify) {
|
||||
co_await mm.container().invoke_on(0, [ks = std::move(ks), cf = std::move(cf), modify = std::move(modify)] (service::migration_manager& mm) -> future<> {
|
||||
|
||||
@@ -33,11 +33,6 @@ const std::map<sstring, sstring>* get_tags_of_table(schema_ptr schema);
|
||||
// tags exist but not this tag.
|
||||
std::optional<std::string> find_tag(const schema& s, const sstring& tag);
|
||||
|
||||
// FIXME: Updating tags currently relies on updating schema, which may be subject
|
||||
// to races during concurrent updates of the same table. Once Scylla schema updates
|
||||
// are fixed, this issue will automatically get fixed as well.
|
||||
future<> update_tags(service::migration_manager& mm, schema_ptr schema, std::map<sstring, sstring>&& tags_map);
|
||||
|
||||
// modify_tags() atomically modifies the tags on a given table: It reads the
|
||||
// existing tags, passes them as a map to the given function which can modify
|
||||
// the map, and finally writes the modified tags. This read-modify-write
|
||||
|
||||
Reference in New Issue
Block a user