Skip to content

Commit

Permalink
cloud_storage/remote_partition: refactor variant access to use ss::visit
Browse files Browse the repository at this point in the history
(cherry picked from commit 9a541f6)
  • Loading branch information
andijcr authored and vbotbuildovich committed Jan 26, 2024
1 parent 73e8474 commit abf1e8c
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/v/cloud_storage/remote_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,24 +524,30 @@ class partition_record_batch_reader_impl final

if (
cur.error() == error_outcome::out_of_range
&& std::holds_alternative<kafka::offset>(query)) {
// Special case queries below the start offset of the log.
// The start offset may have advanced while the request was
// in progress. This is expected, so log at debug level.
const auto log_start_offset = _partition->_manifest_view
->stm_manifest()
.full_log_start_kafka_offset();

const auto query_offset = std::get<kafka::offset>(query);
if (log_start_offset && query_offset < *log_start_offset) {
vlog(
_ctxlog.debug,
"Manifest query below the log's start Kafka offset: {} < "
"{}",
query_offset(),
log_start_offset.value()());
co_return;
}
&& ss::visit(
query,
[&](kafka::offset query_offset) {
// Special case queries below the start offset of the log.
// The start offset may have advanced while the request was
// in progress. This is expected, so log at debug level.
const auto log_start_offset
= _partition->_manifest_view->stm_manifest()
.full_log_start_kafka_offset();

if (log_start_offset && query_offset < *log_start_offset) {
vlog(
_ctxlog.debug,
"Manifest query below the log's start Kafka offset: "
"{} < {}",
query_offset(),
log_start_offset.value()());
return true;
}
return false;
},
[](auto) { return false; })) {
// error was handled
co_return;
}

vlog(
Expand Down

0 comments on commit abf1e8c

Please sign in to comment.