Skip to content

Commit 8ac19b7

Browse files
committed
archival/tests: yield more often to the scheduler
Adding a second takes ~1ms. Adding multiple of them in a single batch can stall the reactor for a while. This, together with a recent seastar change[^1] caused some timeouts to fire very frequently[^2]. Fix the test by breaking the batch passed to add_segments into smaller segments so that we execute more finer grained tasks and yield more often to the scheduler. [^1]: scylladb/seastar#2238 [^2]: redpanda-data#13275
1 parent 1acaf9d commit 8ac19b7

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

src/v/archival/tests/ntp_archiver_test.cc

+23-12
Original file line numberDiff line numberDiff line change
@@ -1701,21 +1701,32 @@ static void test_manifest_spillover_impl(
17011701
}).get();
17021702

17031703
// Generate new manifest based on data layout on disk
1704-
std::vector<cloud_storage::segment_meta> all_segments;
1704+
vlog(test_log.debug, "stm add segments");
1705+
auto add_segments =
1706+
[&part](std::vector<cloud_storage::segment_meta> segments) {
1707+
part->archival_meta_stm()
1708+
->add_segments(
1709+
std::move(segments),
1710+
std::nullopt,
1711+
model::producer_id{},
1712+
ss::lowres_clock::now() + 1s,
1713+
never_abort,
1714+
cluster::segment_validated::yes)
1715+
.get();
1716+
};
1717+
1718+
// 10 at a time to avoid reactor stalls.
1719+
const int max_batch_size = 10;
1720+
std::vector<cloud_storage::segment_meta> batch;
17051721
for (const auto& s : manifest) {
1706-
all_segments.push_back(s);
1722+
if (batch.size() >= max_batch_size) {
1723+
add_segments(batch);
1724+
batch.clear();
1725+
}
1726+
batch.push_back(s);
17071727
}
1728+
add_segments(batch);
17081729

1709-
vlog(test_log.debug, "stm add segments");
1710-
part->archival_meta_stm()
1711-
->add_segments(
1712-
all_segments,
1713-
std::nullopt,
1714-
model::producer_id{},
1715-
ss::lowres_clock::now() + 1s,
1716-
never_abort,
1717-
cluster::segment_validated::yes)
1718-
.get();
17191730
vlog(test_log.debug, "stm add segments completed");
17201731

17211732
vlog(

0 commit comments

Comments
 (0)