Skip to content

Commit

Permalink
Merge pull request #7633 from jcsp/storage-assert-eio
Browse files Browse the repository at this point in the history
storage: assert out on EIO in read
  • Loading branch information
jcsp committed Dec 12, 2022
2 parents be14638 + 875faa4 commit 8694d84
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/v/storage/log_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,23 @@ log_segment_batch_reader::read_some(model::timeout_clock::time_point timeout) {
_iterator = co_await initialize(timeout, cache_read.next_cached_batch);
}
auto ptr = _iterator.get();
co_return co_await ptr->consume().then(
[this](result<size_t> bytes_consumed) -> result<records_t> {
co_return co_await ptr->consume()
.then([this](result<size_t> bytes_consumed) -> result<records_t> {
if (!bytes_consumed) {
return bytes_consumed.error();
}
auto tmp = std::exchange(_state, {});
return result<records_t>(std::move(tmp.buffer));
});
})
.handle_exception_type(
[](const std::system_error& ec) -> ss::future<result<records_t>> {
if (ec.code().value() == EIO) {
vassert(false, "I/O error during read! Disk failure?");
} else {
return ss::make_exception_future<result<records_t>>(
std::current_exception());
}
});
}

log_reader::log_reader(
Expand Down

0 comments on commit 8694d84

Please sign in to comment.