Skip to content

Commit

Permalink
Test support for capturing segment appender
Browse files Browse the repository at this point in the history
run_concurrent_append_flush is a fuzzer-like test and we may have
hard-to-diagnose failures there (e.g., see issue redpanda-data#13035) and to help
diagnose it we want to capture
some information from the segment_appender at each step of the
test.

Introduce segment_appender_info to do this.
  • Loading branch information
travisdowns committed Dec 2, 2023
1 parent 664115a commit 4e4a1e3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/v/storage/tests/log_segment_appender_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@
using namespace storage; // NOLINT
using namespace std::chrono;

// miscellaneous captured info about a segment appender such as
// its offsets and other counters
struct segment_appender_info {
size_t committed_offset, stable_offset, flushed_offset, bytes_flush_pending,
inflight_dispatched;

ss::sstring to_string() const {
return fmt::format(
"co {} : so {} : fo {} : fbp {} : bfp {}",
committed_offset,
stable_offset,
flushed_offset,
bytes_flush_pending,
inflight_dispatched);
}
};

struct storage::segment_appender_test_accessor {
segment_appender& sa; // NOLINT

Expand All @@ -54,6 +71,14 @@ struct storage::segment_appender_test_accessor {
auto inflight_dispatched() { return sa._inflight_dispatched; }
auto total_dispatched() { return sa._dispatched_writes; }
auto total_merged() { return sa._merged_writes; }
auto info() {
return segment_appender_info{
.committed_offset = sa._committed_offset,
.stable_offset = sa._stable_offset,
.flushed_offset = sa._flushed_offset,
.bytes_flush_pending = sa._bytes_flush_pending,
.inflight_dispatched = sa._inflight_dispatched};
}
};

namespace {
Expand Down

0 comments on commit 4e4a1e3

Please sign in to comment.