sstables: remove_temp_dir: do not return then_wrapped future

f.get_exception makes the future invalid so it must not be returned.
Instead, make_exception_future<> with the exception ptr.

Fixes #4435.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190415111909.30499-1-bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2019-04-15 14:19:09 +03:00
committed by Avi Kivity
parent b9327f81cf
commit b543ab4c76

View File

@@ -2531,12 +2531,13 @@ future<> sstable::remove_temp_dir() {
}
sstlog.debug("Removing temp_dir={}", _temp_dir);
return remove_file(*_temp_dir).then_wrapped([this] (future<> f) {
if (f.failed()) {
sstlog.error("Could not remove temporary directory: {}", f.get_exception());
} else {
if (!f.failed()) {
_temp_dir.reset();
return make_ready_future<>();
}
return f;
auto ep = f.get_exception();
sstlog.error("Could not remove temporary directory: {}", ep);
return make_exception_future<>(ep);
});
}