From 49d232e4668c534fe6744635a5b0c7056aaa7f9d Mon Sep 17 00:00:00 2001 From: Yury Luneff Date: Mon, 30 Nov 2026 10:51:09 +0300 Subject: [PATCH] test_pg_chaos: Add store v1 configurations behind --v1 The chaos test always ran the new store (meta_format 3), so the store v1 path was not covered. Add 4 configurations that run the OSDs on store v1 (immediate_commit=all): replicated and EC 2+2, each without checksums and with checksums (4K replicated, 32K EC). Store v1 has no tombstones, so the primary falls back to legacy deletes (osd_peering.cpp); the v1 configurations set peer_tombstones=false to match. They are appended and selected only with --v1, and they don't add to the default fixed seed range, so the existing seeds keep their configurations and the default run keeps its seeds. --- docs/tests/pg-chaos.en.md | 4 ++++ docs/tests/pg-chaos.ru.md | 4 ++++ src/test/test_pg_chaos.cpp | 44 +++++++++++++++++++++++++++----------- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/docs/tests/pg-chaos.en.md b/docs/tests/pg-chaos.en.md index bd602f3d..6712f614 100644 --- a/docs/tests/pg-chaos.en.md +++ b/docs/tests/pg-chaos.en.md @@ -26,6 +26,10 @@ it is covered by the [blockstore chaos test](blockstore-chaos.en.md). - immediate_commit none/all × - csum_block none/4096/16384 +Plus 4 store v1 (meta_format 2) configurations, run only with `--v1`: immediate_commit=all, +replicated with csum_block none/4096 and EC with csum_block none/32768, with legacy deletes +(store v1 has no tombstones). + `--recovery` enables recovery/rebalance after a set change (off by default so that degraded states get exercised). diff --git a/docs/tests/pg-chaos.ru.md b/docs/tests/pg-chaos.ru.md index c09c20df..f8ee25eb 100644 --- a/docs/tests/pg-chaos.ru.md +++ b/docs/tests/pg-chaos.ru.md @@ -23,6 +23,10 @@ stop_pg, INCOMPLETE, recovery) и частично хранилище перви - immediate_commit none/all × - csum_block нет/4096/16384 +И ещё 4 конфигурации store v1 (meta_format 2), только с `--v1`: immediate_commit=all, +replicated с csum_block нет/4096 и EC с csum_block нет/32768, с удалением без tombstone +(в store v1 их нет). + `--recovery` включает recovery/rebalance после set-change (по умолчанию выкл, чтобы гонять degraded-состояния). diff --git a/src/test/test_pg_chaos.cpp b/src/test/test_pg_chaos.cpp index d0c448cc..60479ca1 100644 --- a/src/test/test_pg_chaos.cpp +++ b/src/test/test_pg_chaos.cpp @@ -42,6 +42,7 @@ #include "allocator.h" #include "ringloop_mock.h" #include "blockstore_impl.h" +#include "v1/impl.h" #include "osd_primary.h" #include "osd_test_fixture.h" #include "etcd_state_client_mock.h" @@ -154,6 +155,8 @@ struct chaos_cfg_t // false: peers don't advertise tombstone support - deletes must fall // back to the legacy single-phase flow bool peer_tombstones = true; + // true: store v1 (meta_format 2) instead of the new store + bool v1 = false; }; // What we believe about one object. @@ -368,6 +371,7 @@ struct chaos_model_t obj_model_t objs[OBJ_COUNT]; bool use_fsync = false; + bool use_v1 = false; // PG geometry from the configuration. For EC the primary's blockstore blocks are // half-object: an object is one parity stripe of EC_DATA data blocks + EC_PARITY @@ -550,7 +554,7 @@ struct chaos_t : chaos_model_t disk_mock_t *data_disk = NULL; - blockstore_impl_t *bs = NULL; + blockstore_i *bs = NULL; uint64_t crashes = 0, restarts = 0, takeovers = 0, writes = 0, deletes = 0, syncs = 0; // How many peer crashes kept their never-fsynced journal tail (only drawn @@ -1379,6 +1383,7 @@ void chaos_t::configure(const chaos_cfg_t & cfg) { f.peer_tombstones = cfg.peer_tombstones; use_fsync = cfg.use_fsync; + use_v1 = cfg.v1; is_ec = cfg.ec; if (is_ec) { @@ -1418,7 +1423,7 @@ void chaos_t::configure(const chaos_cfg_t & cfg) { "etcd_stats_interval", (uint64_t)100000000 }, { "data_offset", "33554432" }, { "disable_data_fsync", cfg.use_fsync ? "0" : "1" }, - { "meta_format", (uint64_t)3 }, + { "meta_format", (uint64_t)(cfg.v1 ? 2 : 3) }, { "log_level", (uint64_t)(trace ? 5 : 0) }, // Recovery auto-tune measures wall-clock op latency (op_stat_sum comes from // CLOCK_REALTIME tv_begin/tv_end) and feeds it into recovery_target_sleep_us: @@ -2139,7 +2144,10 @@ void chaos_t::start_osd() f.osd = new osd_t(osd_config, f.ringloop, f.tfd, std::unique_ptr(st_cli), [this](blockstore_config_t & cfg) -> blockstore_i* { - bs = new blockstore_impl_t(cfg, f.ringloop, f.tfd, true); + if (use_v1) + bs = new v1::blockstore_impl_t(cfg, f.ringloop, f.tfd, true); + else + bs = new blockstore_impl_t(cfg, f.ringloop, f.tfd, true); return bs; }); } @@ -4564,11 +4572,11 @@ void fake_peer_t::apply(osd_op_t *op) static void run_one(const chaos_cfg_t & cfg, uint32_t seed, uint64_t steps, bool trace) { - printf("\n-- chaos pg seed=%u steps=%ju fsync=%d csum_block=%s scheme=%s recovery=%d\n", + printf("\n-- chaos pg seed=%u steps=%ju fsync=%d csum_block=%s scheme=%s recovery=%d%s\n", seed, steps, cfg.use_fsync ? 1 : 0, cfg.csum_block ? std::to_string(cfg.csum_block).c_str() : "none", cfg.ec ? "ec2+2" : "replicated", - cfg.recovery ? 1 : 0); + cfg.recovery ? 1 : 0, cfg.v1 ? " store=v1" : ""); chaos_t t; t.trace = trace; t.configure(cfg); @@ -4620,6 +4628,12 @@ static chaos_cfg_t configs[] = { { .use_fsync = false, .csum_block = 16384, .ec = true }, { .use_fsync = true , .csum_block = 4096, .ec = true }, { .use_fsync = true , .csum_block = 0, .ec = true }, + // Store v1, selected only with --v1 so that the seeds above keep their configurations. + // It has no tombstones, so the primary falls back to legacy deletes (osd_peering.cpp) + { .use_fsync = false, .csum_block = 0, .ec = false, .peer_tombstones = false, .v1 = true }, + { .use_fsync = false, .csum_block = 4096, .ec = false, .peer_tombstones = false, .v1 = true }, + { .use_fsync = false, .csum_block = 0, .ec = true, .peer_tombstones = false, .v1 = true }, + { .use_fsync = false, .csum_block = 32768, .ec = true, .peer_tombstones = false, .v1 = true }, }; static const char *help_text = @@ -4655,6 +4669,7 @@ static const char *help_text = " --peer-cache-loss

Percent of peer crashes that drop the never-fsynced\n" " journal tail (default 50; 100 to always drop it)\n" " --replicated Run only the replicated x3 configurations\n" + " --v1 Run only the store v1 (meta_format 2) configurations\n" " -v, --trace Trace every operation and every simulated disk request\n" " -h, --help Show this help\n" "\n" @@ -4691,9 +4706,9 @@ static void print_help(int cfg_count, int default_seeds, int default_fixed, int d.peer_down, d.peer_up, d.set_change, d.full_read, d.p_reply, d.p_wire, d.p_post, cfg_count); for (int i = 0; i < cfg_count; i++) { - printf(" %2d: fsync=%d, csum_block=%s, scheme=%s\n", i, configs[i].use_fsync ? 1 : 0, + printf(" %2d: fsync=%d, csum_block=%s, scheme=%s%s\n", i, configs[i].use_fsync ? 1 : 0, configs[i].csum_block ? std::to_string(configs[i].csum_block).c_str() : "none", - configs[i].ec ? "ec 2+2" : "replicated x3"); + configs[i].ec ? "ec 2+2" : "replicated x3", configs[i].v1 ? ", store v1" : ""); } } @@ -4734,12 +4749,15 @@ int main(int narg, char *args[]) const int cfg_count = sizeof(configs)/sizeof(configs[0]); const int default_seeds = 100; // Every configuration twice as a fixed regression floor, and the rest of the run filled up - // with random seeds so that every build tries situations the previous ones never reached - const int default_fixed = 2*cfg_count; + // with random seeds so that every build tries situations the previous ones never reached. + // The --v1 configurations don't count, so the default run keeps its seeds + int default_fixed = 0; + for (auto & c: configs) + default_fixed += c.v1 ? 0 : 2; const int default_random = default_seeds > default_fixed ? default_seeds-default_fixed : 0; bool recovery = false; bool legacy_peers = false; - bool ec_only = false, rep_only = false; + bool ec_only = false, rep_only = false, v1_only = false; bool trace = false, single = false, seeds_given = false, random_given = false; uint32_t seed_from = 1, seed_to = default_fixed, seed = 0; int random_count = default_random; @@ -4820,6 +4838,7 @@ int main(int narg, char *args[]) else if (!strcmp(opt, "--recovery")) recovery = true; else if (!strcmp(opt, "--legacy-peers")) legacy_peers = true; else if (!strcmp(opt, "--ec")) ec_only = true; + else if (!strcmp(opt, "--v1")) v1_only = true; else if (!strcmp(opt, "--replicated")) rep_only = true; else if (!strcmp(opt, "--p-restart")) { take(v); probs.restart = (uint32_t)v; } else if (!strcmp(opt, "--p-takeover")) { take(v); probs.takeover = (uint32_t)v; } @@ -4861,11 +4880,12 @@ int main(int narg, char *args[]) for (auto & c: configs) c.peer_tombstones = false; } - // --ec / --replicated restrict the seed-to-configuration mapping to one scheme + // --ec / --replicated restrict the seed-to-configuration mapping to one scheme, + // --v1 to the store v1 configurations, which are left out otherwise std::vector cfg_sel; for (int i = 0; i < cfg_count; i++) { - if ((!ec_only || configs[i].ec) && (!rep_only || !configs[i].ec)) + if ((!ec_only || configs[i].ec) && (!rep_only || !configs[i].ec) && configs[i].v1 == v1_only) cfg_sel.push_back(i); } if (!cfg_sel.size()) -- 2.47.3