Skip to content

Commit

Permalink
Merge pull request redpanda-data#18411 from nvartolomei/nv/archiver-t…
Browse files Browse the repository at this point in the history
…imeout-fix

archival/tests: yield more often to the scheduler
  • Loading branch information
nvartolomei authored May 13, 2024
2 parents cf0430c + 545a04f commit deb7fb0
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions src/v/archival/tests/ntp_archiver_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1701,21 +1701,32 @@ static void test_manifest_spillover_impl(
}).get();

// Generate new manifest based on data layout on disk
std::vector<cloud_storage::segment_meta> all_segments;
vlog(test_log.debug, "stm add segments");
auto add_segments =
[&part](std::vector<cloud_storage::segment_meta> segments) {
part->archival_meta_stm()
->add_segments(
std::move(segments),
std::nullopt,
model::producer_id{},
ss::lowres_clock::now() + 1s,
never_abort,
cluster::segment_validated::yes)
.get();
};

// 10 at a time to avoid reactor stalls.
const int max_batch_size = 10;
std::vector<cloud_storage::segment_meta> batch;
for (const auto& s : manifest) {
all_segments.push_back(s);
if (batch.size() >= max_batch_size) {
add_segments(batch);
batch.clear();
}
batch.push_back(s);
}
add_segments(batch);

vlog(test_log.debug, "stm add segments");
part->archival_meta_stm()
->add_segments(
all_segments,
std::nullopt,
model::producer_id{},
ss::lowres_clock::now() + 1s,
never_abort,
cluster::segment_validated::yes)
.get();
vlog(test_log.debug, "stm add segments completed");

vlog(
Expand Down

0 comments on commit deb7fb0

Please sign in to comment.