commitlog::read_log_file: Preserve subscription across reading

Fixes #6265

Return type for read_log_file was previously changed from
subscription to future<>, returning the previously returned
subscriptions result of done(). But it did not preserve the
subscription itself, which in turn will cause us to (in
work::stream), call back into a deleted object.

Message-Id: <20200422090856.5218-1-calle@scylladb.com>
(cherry picked from commit 525b283326)
This commit is contained in:
Calle Wilund
2020-04-22 09:08:56 +00:00
committed by Avi Kivity
parent a3eb12c5f1
commit ae32aa970a

View File

@@ -2133,8 +2133,9 @@ db::commitlog::read_log_file(const sstring& filename, const sstring& pfx, seasta
}).handle_exception([w](auto ep) {
w->s.set_exception(ep);
});
return ret.done();
// #6265 - must keep subscription alive.
auto res = ret.done();
return res.finally([ret = std::move(ret)] {});
});
}