From 8cbd26cc272dd1da344e2817c473efb9c9cddb67 Mon Sep 17 00:00:00 2001 From: Abhijat Malviya Date: Wed, 1 Nov 2023 20:11:17 +0530 Subject: [PATCH] add ID to trace reader stop --- src/v/cloud_storage/remote_partition.cc | 6 +++++- src/v/cloud_storage/remote_segment.cc | 13 ++++++++++++- src/v/cloud_storage/remote_segment.h | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/v/cloud_storage/remote_partition.cc b/src/v/cloud_storage/remote_partition.cc index 83b17c1426b1c..cd6149cbf2e56 100644 --- a/src/v/cloud_storage/remote_partition.cc +++ b/src/v/cloud_storage/remote_partition.cc @@ -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)); } }); @@ -826,7 +830,7 @@ ss::future<> remote_partition::start() { void remote_partition::evict_segment_reader( std::unique_ptr reader) { - _eviction_pending.push_back(std::move(reader)); + _eviction_pending.emplace_back(std::move(reader)); _has_evictions_cvar.signal(); } diff --git a/src/v/cloud_storage/remote_segment.cc b/src/v/cloud_storage/remote_segment.cc index f727d1579733f..cf870fe3d285e 100644 --- a/src/v/cloud_storage/remote_segment.cc +++ b/src/v/cloud_storage/remote_segment.cc @@ -48,6 +48,8 @@ #include #include +#include +#include #include #include @@ -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(); } @@ -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; } diff --git a/src/v/cloud_storage/remote_segment.h b/src/v/cloud_storage/remote_segment.h index 9dc8bfc0aa62f..ad5258d3f0fed 100644 --- a/src/v/cloud_storage/remote_segment.h +++ b/src/v/cloud_storage/remote_segment.h @@ -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, const storage::log_reader_config& config,