Skip to content

Commit

Permalink
Merge pull request #24737 from bharathv/fix_rm_stm_tests_broken
Browse files Browse the repository at this point in the history
rm_stm_tests: fix broken test
  • Loading branch information
bharathv authored Jan 10, 2025
2 parents 959b2a4 + b203acf commit f7e0746
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/v/cluster/producer_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,13 @@ std::ostream& operator<<(std::ostream& o, const producer_state& state) {
fmt::print(
o,
"{{ id: {}, group: {}, requests: {}, "
"ms_since_last_update: {}, evicted: {}, ",
"ms_since_last_update: {}, evicted: {}, last_known_sequence: {}, ",
state._id,
state._group,
state._requests,
state.ms_since_last_update(),
state._evicted);
state._evicted,
state.last_sequence_number());
if (state._transaction_state) {
fmt::print(o, "transaction_state: {}", *state._transaction_state);
} else {
Expand Down
28 changes: 16 additions & 12 deletions src/v/cluster/tests/rm_stm_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,22 @@ static batches_with_identity make_rreader(
int first_seq,
int count,
bool is_transactional) {
return batches_with_identity{
.id = model::
batch_identity{.pid = pid, .first_seq = first_seq, .last_seq = first_seq + count - 1, .record_count = count, .is_transactional = is_transactional},
.batches = random_batches(model::test::record_batch_spec{
.offset = model::offset(0),
.allow_compression = true,
.count = count,
.producer_id = pid.id,
.producer_epoch = pid.epoch,
.base_sequence = first_seq,
.is_transactional = is_transactional})
.get()};
batches_with_identity result;
result.id = {
.pid = pid,
.first_seq = first_seq,
.last_seq = first_seq + count - 1,
.record_count = count,
.is_transactional = is_transactional};
result.batches.push_back(model::test::make_random_batch(
{.offset = model::offset(0),
.allow_compression = true,
.count = count,
.producer_id = pid.id,
.producer_epoch = pid.epoch,
.base_sequence = first_seq,
.is_transactional = is_transactional}));
return result;
}

void check_snapshot_sizes(cluster::rm_stm& stm, raft::consensus* c) {
Expand Down

0 comments on commit f7e0746

Please sign in to comment.