view: reindent maybe_mark_view_as_built
Several identation levels were harmed during the preparation of this patch.
This commit is contained in:
@@ -2314,33 +2314,29 @@ future<> view_builder::maybe_mark_view_as_built(view_ptr view, dht::token next_t
|
||||
[] (bool result, bool shard_complete) {
|
||||
return result && shard_complete;
|
||||
});
|
||||
{
|
||||
if (built) {
|
||||
inject_failure("view_builder_mark_view_as_built");
|
||||
co_await container().invoke_on_all(coroutine::lambda([view_id = view->id()] (view_builder& builder) -> future<> {
|
||||
if (builder._built_views.erase(view_id) == 0 || this_shard_id() != 0) {
|
||||
co_return;
|
||||
}
|
||||
auto view = builder._db.find_schema(view_id);
|
||||
vlogger.info("Finished building view {}.{}", view->ks_name(), view->cf_name());
|
||||
co_await coroutine::all(
|
||||
[&] { return system_keyspace::mark_view_as_built(view->ks_name(), view->cf_name()); },
|
||||
[&] { return builder._sys_dist_ks.finish_view_build(view->ks_name(), view->cf_name()); }
|
||||
);
|
||||
{
|
||||
// The view is built, so shard 0 can remove the entry in the build progress system table on
|
||||
// behalf of all shards. It is guaranteed to have a higher timestamp than the per-shard entries.
|
||||
co_await system_keyspace::remove_view_build_progress_across_all_shards(view->ks_name(), view->cf_name());
|
||||
if (built) {
|
||||
inject_failure("view_builder_mark_view_as_built");
|
||||
co_await container().invoke_on_all(coroutine::lambda([view_id = view->id()] (view_builder& builder) -> future<> {
|
||||
if (builder._built_views.erase(view_id) == 0 || this_shard_id() != 0) {
|
||||
co_return;
|
||||
}
|
||||
auto view = builder._db.find_schema(view_id);
|
||||
vlogger.info("Finished building view {}.{}", view->ks_name(), view->cf_name());
|
||||
co_await coroutine::all(
|
||||
[&] { return system_keyspace::mark_view_as_built(view->ks_name(), view->cf_name()); },
|
||||
[&] { return builder._sys_dist_ks.finish_view_build(view->ks_name(), view->cf_name()); }
|
||||
);
|
||||
// The view is built, so shard 0 can remove the entry in the build progress system table on
|
||||
// behalf of all shards. It is guaranteed to have a higher timestamp than the per-shard entries.
|
||||
co_await system_keyspace::remove_view_build_progress_across_all_shards(view->ks_name(), view->cf_name());
|
||||
|
||||
auto it = builder._build_notifiers.find(std::pair(view->ks_name(), view->cf_name()));
|
||||
if (it != builder._build_notifiers.end()) {
|
||||
it->second.set_value();
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
co_await system_keyspace::update_view_build_progress(view->ks_name(), view->cf_name(), next_token);
|
||||
auto it = builder._build_notifiers.find(std::pair(view->ks_name(), view->cf_name()));
|
||||
if (it != builder._build_notifiers.end()) {
|
||||
it->second.set_value();
|
||||
}
|
||||
}));
|
||||
}
|
||||
co_await system_keyspace::update_view_build_progress(view->ks_name(), view->cf_name(), next_token);
|
||||
}
|
||||
|
||||
future<> view_builder::wait_until_built(const sstring& ks_name, const sstring& view_name) {
|
||||
|
||||
Reference in New Issue
Block a user