diff --git a/src/v/storage/tests/BUILD b/src/v/storage/tests/BUILD index ac0971ff1093e..5912b9922f87e 100644 --- a/src/v/storage/tests/BUILD +++ b/src/v/storage/tests/BUILD @@ -63,6 +63,48 @@ redpanda_test_cc_library( ], ) +redpanda_test_cc_library( + name = "common", + hdrs = [ + "common.h", + ], + include_prefix = "storage/tests", + deps = [ + "//src/v/storage", + ], +) + +redpanda_test_cc_library( + name = "storage_test_fixture", + hdrs = [ + "storage_test_fixture.h", + ], + include_prefix = "storage/tests", + deps = [ + "//src/v/compression", + "//src/v/config", + "//src/v/features", + "//src/v/model/tests:random", + "//src/v/storage", + "//src/v/test_utils:seastar_boost", + ], +) + +redpanda_test_cc_library( + name = "log_gap_analysis", + srcs = [ + "utils/log_gap_analysis.cc", + ], + hdrs = [ + "utils/log_gap_analysis.h", + ], + include_prefix = "storage/tests", + deps = [ + "//src/v/model", + "//src/v/storage:parser_utils", + ], +) + redpanda_cc_gtest( name = "segment_offset_tracker_test", timeout = "short", @@ -461,3 +503,41 @@ redpanda_cc_gtest( "@seastar", ], ) + +redpanda_cc_btest( + name = "storage_e2e_single_thread", + timeout = "moderate", + srcs = [ + "storage_e2e_test.cc", + ], + cpu = 1, + deps = [ + ":common", + ":disk_log_builder", + ":disk_log_builder_fixture", + ":log_gap_analysis", + ":storage_test_fixture", + "//src/v/base", + "//src/v/bytes", + "//src/v/bytes:random", + "//src/v/compression", + "//src/v/config", + "//src/v/features", + "//src/v/finjector", + "//src/v/model", + "//src/v/model/tests:random", + "//src/v/random:generators", + "//src/v/reflection:adl", + "//src/v/storage", + "//src/v/storage:batch_cache", + "//src/v/storage:record_batch_builder", + "//src/v/storage:resources", + "//src/v/test_utils:random", + "//src/v/test_utils:seastar_boost", + "//src/v/utils:directory_walker", + "//src/v/utils:to_string", + "@boost//:test", + "@fmt", + "@seastar", + ], +) diff --git a/src/v/storage/tests/storage_e2e_test.cc b/src/v/storage/tests/storage_e2e_test.cc index cfc3fda99c6db..2f62724672408 100644 --- a/src/v/storage/tests/storage_e2e_test.cc +++ b/src/v/storage/tests/storage_e2e_test.cc @@ -380,7 +380,7 @@ FIXTURE_TEST(test_truncation_with_write_caching, storage_test_fixture) { const auto truncate_batch_ix = headers.size() - 2; const auto truncate_offset = [&]() { model::offset o{0}; - for (auto i = 0; i < truncate_batch_ix; i++) { + for (size_t i = 0; i < truncate_batch_ix; i++) { o += headers[i].record_count; } return o; @@ -937,7 +937,7 @@ ss::future append_exactly( val_sz -= real_batch_size; - for (int i = 0; i < batch_count; ++i) { + for (size_t i = 0; i < batch_count; ++i) { storage::record_batch_builder builder(batch_type, model::offset{}); iobuf value = bytes_to_iobuf(random_generators::get_bytes(val_sz)); builder.add_raw_kv(key_buf.copy(), std::move(value)); @@ -1050,7 +1050,7 @@ FIXTURE_TEST(append_concurrent_with_prefix_truncate, storage_test_fixture) { auto log = mgr.manage(std::move(ntp_cfg)).get0(); bool stop = false; - int cnt = 0; + size_t cnt = 0; std::vector types{ model::record_batch_type::raft_data, model::record_batch_type::raft_configuration}; @@ -2445,7 +2445,7 @@ FIXTURE_TEST(changing_cleanup_policy_back_and_forth, storage_test_fixture) { // add a segment, some of the record keys in batches are random and some of // them are the same to generate offset gaps after compaction - auto add_segment = [&log, disk_log](size_t size, model::term_id term) { + auto add_segment = [&log, disk_log](size_t size) { do { // 10 records per batch for (int i = 0; i < 10; ++i) { @@ -2481,11 +2481,11 @@ FIXTURE_TEST(changing_cleanup_policy_back_and_forth, storage_test_fixture) { } while (disk_log->segments().back()->size_bytes() < size); }; // add 2 log segments - add_segment(1_MiB, model::term_id(1)); + add_segment(1_MiB); disk_log->force_roll(ss::default_priority_class()).get(); - add_segment(1_MiB, model::term_id(1)); + add_segment(1_MiB); disk_log->force_roll(ss::default_priority_class()).get(); - add_segment(1_MiB, model::term_id(1)); + add_segment(1_MiB); log->flush().get(); BOOST_REQUIRE_EQUAL(disk_log->segment_count(), 3); @@ -3840,7 +3840,7 @@ FIXTURE_TEST(test_bytes_eviction_overrides, storage_test_fixture) { auto deferred_rm = ss::defer( [&mgr, ntp]() mutable { mgr.remove(ntp).get(); }); - for (int i = 0; i < batch_cnt; ++i) { + for (size_t i = 0; i < batch_cnt; ++i) { append_exactly(log, 1, batch_size).get(); } auto disk_log = log; @@ -4261,7 +4261,7 @@ FIXTURE_TEST(test_offset_range_size, storage_test_fixture) { auto log = mgr.manage(std::move(ntp_cfg)).get(); model::offset first_segment_last_offset; - for (int i = 0; i < num_segments; i++) { + for (size_t i = 0; i < num_segments; i++) { append_random_batches( log, 10, @@ -4374,7 +4374,7 @@ FIXTURE_TEST(test_offset_range_size2, storage_test_fixture) { auto log = mgr.manage(std::move(ntp_cfg)).get(); model::offset first_segment_last_offset; - for (int i = 0; i < num_segments; i++) { + for (size_t i = 0; i < num_segments; i++) { append_random_batches( log, 10, @@ -4578,7 +4578,7 @@ FIXTURE_TEST(test_offset_range_size_compacted, storage_test_fixture) { auto log = mgr.manage(std::move(ntp_cfg)).get(); model::offset first_segment_last_offset; - for (int i = 0; i < num_segments; i++) { + for (size_t i = 0; i < num_segments; i++) { append_random_batches( log, 10, model::term_id(i), key_limited_random_batch_generator()); if (first_segment_last_offset == model::offset{}) { @@ -4777,7 +4777,7 @@ FIXTURE_TEST(test_offset_range_size2_compacted, storage_test_fixture) { auto log = mgr.manage(std::move(ntp_cfg)).get(); model::offset first_segment_last_offset; - for (int i = 0; i < num_segments; i++) { + for (size_t i = 0; i < num_segments; i++) { append_random_batches( log, 10, model::term_id(0), key_limited_random_batch_generator()); if (first_segment_last_offset == model::offset{}) { @@ -5079,7 +5079,7 @@ FIXTURE_TEST(test_offset_range_size_incremental, storage_test_fixture) { auto log = mgr.manage(std::move(ntp_cfg)).get(); model::offset first_segment_last_offset; - for (int i = 0; i < num_segments; i++) { + for (size_t i = 0; i < num_segments; i++) { append_random_batches( log, 10,