Skip to content

Commit

Permalink
add ID to trace reader stop
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijat committed Nov 1, 2023
1 parent ce74347 commit 8cbd26c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/v/cloud_storage/remote_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ class partition_record_batch_reader_impl final
auto sub = config.abort_source->get().subscribe([this]() noexcept {
vlog(_ctxlog.debug, "abort requested via config.abort_source");
if (_reader) {
vlog(
_ctxlog.debug,
"abort requested via config.abort_source for reader {}",
_reader->identifier);
_partition->evict_segment_reader(std::move(_reader));
}
});
Expand Down Expand Up @@ -826,7 +830,7 @@ ss::future<> remote_partition::start() {

void remote_partition::evict_segment_reader(
std::unique_ptr<remote_segment_batch_reader> reader) {
_eviction_pending.push_back(std::move(reader));
_eviction_pending.emplace_back(std::move(reader));
_has_evictions_cvar.signal();
}

Expand Down
13 changes: 12 additions & 1 deletion src/v/cloud_storage/remote_segment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include <seastar/util/defer.hh>
#include <seastar/util/log.hh>

#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <fmt/core.h>

#include <exception>
Expand Down Expand Up @@ -1282,6 +1284,7 @@ remote_segment_batch_reader::remote_segment_batch_reader(
, _cur_rp_offset(_seg->get_base_rp_offset())
, _cur_delta(_seg->get_base_offset_delta())
, _units(std::move(units)) {
identifier = boost::uuids::to_string(boost::uuids::random_generator()());
_ts_probe.segment_reader_created();
}

Expand Down Expand Up @@ -1377,13 +1380,21 @@ ss::future<> remote_segment_batch_reader::stop() {
co_return;
}

vlog(_ctxlog.debug, "remote_segment_batch_reader::stop");
vlog(
_ctxlog.debug,
"remote_segment_batch_reader::stop for reader {}",
identifier);
co_await _gate.close();
if (_parser) {
vlog(_ctxlog.debug, "remote_segment_batch_reader::stop - parser-close");
co_await _parser->close();
_parser.reset();
}

vlog(
_ctxlog.debug,
"remote_segment_batch_reader::stop completed for reader {}",
identifier);
_stopped = true;
}

Expand Down
2 changes: 2 additions & 0 deletions src/v/cloud_storage/remote_segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,8 @@ class remote_segment_batch_reader final {
friend class remote_segment_batch_consumer;

public:
ss::sstring identifier;

remote_segment_batch_reader(
ss::lw_shared_ptr<remote_segment>,
const storage::log_reader_config& config,
Expand Down

0 comments on commit 8cbd26c

Please sign in to comment.