commitlog: change variadic stream in read_log_file to future<struct>

Since seastar::streams are based on future/promise, variadic streams
suffer the same fate as variadic futures - deprecation and eventual
removal.

This patch therefore replaces a variadic stream in commitlog::read_log_file()
with a non-variadic stream, via a helper struct.

Tests: unit (dev)
This commit is contained in:
Avi Kivity
2019-10-29 20:25:12 +02:00
committed by Tomasz Grabiec
parent 271ab750a6
commit 623071020e
5 changed files with 24 additions and 15 deletions

View File

@@ -111,7 +111,7 @@ public:
return _column_mappings.stop();
}
future<> process(stats*, fragmented_temporary_buffer buf, replay_position rp) const;
future<> process(stats*, commitlog::buffer_and_replay_position buf_rp) const;
future<stats> recover(sstring file, const sstring& fname_prefix) const;
typedef std::unordered_map<utils::UUID, replay_position> rp_map;
@@ -226,8 +226,8 @@ db::commitlog_replayer::impl::recover(sstring file, const sstring& fname_prefix)
auto& exts = _db.local().extensions();
return db::commitlog::read_log_file(file, fname_prefix, service::get_local_commitlog_priority(),
std::bind(&impl::process, this, s.get(), std::placeholders::_1,
std::placeholders::_2), p, &exts).then([](auto s) {
std::bind(&impl::process, this, s.get(), std::placeholders::_1),
p, &exts).then([](auto s) {
auto f = s->done();
return f.finally([s = std::move(s)] {});
}).then_wrapped([s](future<> f) {
@@ -242,7 +242,8 @@ db::commitlog_replayer::impl::recover(sstring file, const sstring& fname_prefix)
});
}
future<> db::commitlog_replayer::impl::process(stats* s, fragmented_temporary_buffer buf, replay_position rp) const {
future<> db::commitlog_replayer::impl::process(stats* s, commitlog::buffer_and_replay_position buf_rp) const {
auto&& [buf, rp] = buf_rp;
try {
commitlog_entry_reader cer(buf);