diff --git a/db/sstables-format-selector.cc b/db/sstables-format-selector.cc index f77313cf13..1260a8345f 100644 --- a/db/sstables-format-selector.cc +++ b/db/sstables-format-selector.cc @@ -7,6 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +#include #include "sstables-format-selector.hh" #include "log.hh" #include "replica/database.hh" @@ -61,31 +62,27 @@ future<> sstables_format_selector::do_maybe_select_format(sstables::sstable_vers future<> sstables_format_selector::start() { assert(this_shard_id() == 0); - return read_sstables_format().then([this] { - _features.local().me_sstable.when_enabled(_me_feature_listener); - _features.local().md_sstable.when_enabled(_md_feature_listener); - return make_ready_future<>(); - }); + co_await read_sstables_format(); + _features.local().me_sstable.when_enabled(_me_feature_listener); + _features.local().md_sstable.when_enabled(_md_feature_listener); } future<> sstables_format_selector::stop() { - return _sel.close(); + co_await _sel.close(); } future<> sstables_format_selector::read_sstables_format() { - return db::system_keyspace::get_scylla_local_param(SSTABLE_FORMAT_PARAM_NAME).then([this] (std::optional format_opt) { - if (format_opt) { - sstables::sstable_version_types format = sstables::from_string(*format_opt); - return select_format(format); - } - return make_ready_future<>(); - }); + std::optional format_opt = co_await db::system_keyspace::get_scylla_local_param(SSTABLE_FORMAT_PARAM_NAME); + if (format_opt) { + sstables::sstable_version_types format = sstables::from_string(*format_opt); + co_await select_format(format); + } } future<> sstables_format_selector::select_format(sstables::sstable_version_types format) { logger.info("Selected {} sstables format", to_string(format)); _selected_format = format; - return _db.invoke_on_all([this] (replica::database& db) { + co_await _db.invoke_on_all([this] (replica::database& db) { db.set_format(_selected_format); }); }