Revert "sstables: Close SSTable reader if index exhaustion is detected in fast forward call"

This reverts commit 1fefe597e6.

Can be reverted after auto-closed reader.

Refs #12998.
This commit is contained in:
Raphael S. Carvalho
2023-07-11 21:39:19 -03:00
parent ca8705bd82
commit 8829ff02c5
2 changed files with 1 additions and 22 deletions

View File

@@ -532,7 +532,6 @@ public:
return make_ready_future<>();
}
if (auto r = next()) {
mrlog.trace("flat_multi_range_mutation_reader {}: fast forwarding to range {}", fmt::ptr(this), *r);
return _reader.fast_forward_to(*r);
} else {
_end_of_stream = true;

View File

@@ -1511,9 +1511,6 @@ private:
}
});
}
bool has_sstable_attached() const noexcept {
return bool(_sst);
}
bool is_initialized() const {
return bool(_context);
}
@@ -1522,14 +1519,6 @@ private:
if (is_initialized()) {
co_return true;
}
// If the reader has no SSTable attached, the reader was proactively closed in the
// context of fast-forward calls. The higher level code has no way to know that
// underlying reader is really exhausted, so reader is responsible for releasing
// its resources beforehand. From there on, the reader has the same semantics
// as that of an empty reader.
if (!has_sstable_attached()) {
co_return false;
}
if (_single_partition_read) {
_sst->get_stats().on_single_partition_read();
const auto& key = dht::ring_position_view(_pr.start()->value());
@@ -1623,15 +1612,6 @@ public:
}
_index_in_current_partition = false;
_read_enabled = false;
if (_index_reader->eof()) {
// Close the SSTable reader proactively, if the index is completely exhausted
// and no partition was found in the current fast-forward call. This allows
// disk space of SSTables to be reclaimed earlier if they take part in a
// long-living read and they're deleted midway.
sstlog.trace("Closing reader {} for {} after fast-forward call found that index reached EOF and there's nothing left to read",
fmt::ptr(this), _sst->get_filename());
return close();
}
return make_ready_future<>();
});
}
@@ -1719,7 +1699,7 @@ public:
close_index_reader = _index_reader->close().finally([_ = std::move(_index_reader)] {});
}
return when_all_succeed(std::move(close_context), std::move(close_index_reader)).discard_result().handle_exception([sst = std::move(_sst)] (std::exception_ptr ep) {
return when_all_succeed(std::move(close_context), std::move(close_index_reader)).discard_result().handle_exception([] (std::exception_ptr ep) {
// close can not fail as it is called either from the destructor or from flat_mutation_reader::close
sstlog.warn("Failed closing of sstable_mutation_reader: {}. Ignored since the reader is already done.", ep);
});