everywhere: Update to seastar api v4 (when_all_succeed returning a tuple)

We now just need to replace a few calls to then with then_unpack.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20200618172100.111147-1-espindola@scylladb.com>
This commit is contained in:
Rafael Ávila de Espíndola
2020-06-18 10:21:00 -07:00
committed by Avi Kivity
parent 47f63d021a
commit 64c8164e6c
12 changed files with 13 additions and 13 deletions

View File

@@ -473,7 +473,7 @@ future<> drop_role(const service& ser, std::string_view name) {
future<bool> has_role(const service& ser, std::string_view grantee, std::string_view name) {
return when_all_succeed(
validate_role_exists(ser, name),
ser.get_roles(grantee)).then([name](role_set all_roles) {
ser.get_roles(grantee)).then_unpack([name](role_set all_roles) {
return make_ready_future<bool>(all_roles.count(sstring(name)) != 0);
});
}

View File

@@ -367,7 +367,7 @@ future<> standard_role_manager::drop(std::string_view role_name) const {
{sstring(role_name)}).discard_result();
};
return when_all_succeed(revoke_from_members(), revoke_members_of()).then([delete_role = std::move(delete_role)] {
return when_all_succeed(revoke_from_members(), revoke_members_of()).then_unpack([delete_role = std::move(delete_role)] {
return delete_role();
});
});
@@ -445,7 +445,7 @@ standard_role_manager::grant(std::string_view grantee_name, std::string_view rol
});
};
return when_all_succeed(check_redundant(), check_cycle()).then([this, role_name, grantee_name] {
return when_all_succeed(check_redundant(), check_cycle()).then_unpack([this, role_name, grantee_name] {
return this->modify_membership(grantee_name, role_name, membership_change::add);
});
}

View File

@@ -1230,7 +1230,7 @@ def configure_seastar(build_dir, mode):
'-DSeastar_CXX_FLAGS={}'.format((seastar_cflags + ' ' + modes[mode]['cxx_ld_flags']).replace(' ', ';')),
'-DSeastar_LD_FLAGS={}'.format(seastar_ldflags),
'-DSeastar_CXX_DIALECT=gnu++20',
'-DSeastar_API_LEVEL=3',
'-DSeastar_API_LEVEL=4',
'-DSeastar_UNUSED_RESULT_ERROR=ON',
]

View File

@@ -90,7 +90,7 @@ cql3::statements::list_users_statement::execute(service::storage_proxy& proxy, s
return do_for_each(sorted_roles, [&as, &results](const sstring& role) {
return when_all_succeed(
as.has_superuser(role),
as.underlying_role_manager().can_login(role)).then([&results, &role](bool super, bool login) {
as.underlying_role_manager().can_login(role)).then_unpack([&results, &role](bool super, bool login) {
if (login) {
results->add_column_value(utf8_type->decompose(role));
results->add_column_value(boolean_type->decompose(super));

View File

@@ -375,7 +375,7 @@ list_roles_statement::execute(service::storage_proxy&, service::query_state& sta
return when_all_succeed(
rm.can_login(role),
rm.is_superuser(role),
a.query_custom_options(role)).then([&results, &role](
a.query_custom_options(role)).then_unpack([&results, &role](
bool login,
bool super,
auth::custom_options os) {

View File

@@ -767,7 +767,7 @@ future<> database::drop_column_family(const sstring& ks_name, const sstring& cf_
remove(*cf);
cf->clear_views();
auto& ks = find_keyspace(ks_name);
return when_all_succeed(cf->await_pending_writes(), cf->await_pending_reads()).then([this, &ks, cf, tsf = std::move(tsf), snapshot] {
return when_all_succeed(cf->await_pending_writes(), cf->await_pending_reads()).then_unpack([this, &ks, cf, tsf = std::move(tsf), snapshot] {
return truncate(ks, *cf, std::move(tsf), snapshot).finally([this, cf] {
return cf->stop();
});

View File

@@ -2074,7 +2074,7 @@ static future<schema_mutations> read_table_mutations(distributed<service::storag
read_schema_partition_for_table(proxy, computed_columns(), table.keyspace_name, table.table_name),
read_schema_partition_for_table(proxy, dropped_columns(), table.keyspace_name, table.table_name),
read_schema_partition_for_table(proxy, indexes(), table.keyspace_name, table.table_name),
read_schema_partition_for_table(proxy, scylla_tables(), table.keyspace_name, table.table_name)).then(
read_schema_partition_for_table(proxy, scylla_tables(), table.keyspace_name, table.table_name)).then_unpack(
[] (mutation cf_m, mutation col_m, mutation vv_col_m, mutation c_col_m, mutation dropped_m, mutation idx_m, mutation st_m) {
return schema_mutations{std::move(cf_m), std::move(col_m), std::move(vv_col_m), std::move(c_col_m), std::move(idx_m), std::move(dropped_m), std::move(st_m)};
});

View File

@@ -122,7 +122,7 @@ row_locker::lock_ck(const dht::decorated_key& pk, const clustering_key_prefix& c
waiting_latency.start();
future<lock_type::holder> lock_row = exclusive ? j->second.hold_write_lock(timeout) : j->second.hold_read_lock(timeout);
return when_all_succeed(std::move(lock_partition), std::move(lock_row))
.then([this, pk = &i->first, cpk = &j->first, exclusive, &single_lock_stats, waiting_latency = std::move(waiting_latency)] (auto lock1, auto lock2) mutable {
.then_unpack([this, pk = &i->first, cpk = &j->first, exclusive, &single_lock_stats, waiting_latency = std::move(waiting_latency)] (auto lock1, auto lock2) mutable {
lock1.release();
lock2.release();
waiting_latency.stop();

View File

@@ -1846,7 +1846,7 @@ future<> view_builder::maybe_mark_view_as_built(view_ptr view, dht::token next_t
vlogger.info("Finished building view {}.{}", view->ks_name(), view->cf_name());
return seastar::when_all_succeed(
system_keyspace::mark_view_as_built(view->ks_name(), view->cf_name()),
builder._sys_dist_ks.finish_view_build(view->ks_name(), view->cf_name())).then([view] {
builder._sys_dist_ks.finish_view_build(view->ks_name(), view->cf_name())).then_unpack([view] {
// 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.
return system_keyspace::remove_view_build_progress_across_all_shards(view->ks_name(), view->cf_name());

View File

@@ -498,7 +498,7 @@ future<> gossiper::uninit_messaging_service_handler() {
ms.unregister_gossip_digest_syn(),
ms.unregister_gossip_digest_ack(),
ms.unregister_gossip_digest_ack2()
).then([this] {
).then_unpack([this] {
_ms_registered = false;
});
}

View File

@@ -1415,7 +1415,7 @@ future<> sstable::load(const io_priority_class& pc) {
return seastar::when_all_succeed(
read_compression(pc),
read_filter(pc),
read_summary(pc)).then([this] {
read_summary(pc)).then_unpack([this] {
validate_min_max_metadata();
validate_max_local_deletion_time();
validate_partitioner();

View File

@@ -241,7 +241,7 @@ future<> send_mutation_fragments(lw_shared_ptr<send_info> si) {
});
}();
return when_all_succeed(std::move(source_op), std::move(sink_op)).then([got_error_from_peer, si] {
return when_all_succeed(std::move(source_op), std::move(sink_op)).then_unpack([got_error_from_peer, si] {
if (*got_error_from_peer) {
throw std::runtime_error(format("Peer failed to process mutation_fragment peer={}, plan_id={}, cf_id={}", si->id.addr, si->plan_id, si->cf_id));
}