|
|
|
|
@@ -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<etcd_state_client_t>(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 <p> 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<int> 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())
|
|
|
|
|
|