raft: test: change replication_test to submit one entry at a time

replication_test's state machine is not commutative, so if commands are
applied in different order the states will be different as well. Since
the preemption check was added into co_await in seastar even waiting for
a ready future can preempt which will cause reordering of simultaneously
submitted entries in debug mode. For a long time we tried to keep entries
submission parallel in the test, but with the above seastar change it
is no longer possible to maintain it without changing the state machine
to be commutative. The patch changes the test to submit entries one by
one.

Message-Id: <20210117095147.GA733394@scylladb.com>
This commit is contained in:
Gleb Natapov
2021-01-17 11:51:47 +02:00
committed by Avi Kivity
parent 1a8630e6a7
commit 1ab262e86b

View File

@@ -483,7 +483,7 @@ future<int> run_test(test_case test) {
std::vector<int> values(n);
std::iota(values.begin(), values.end(), next_val);
std::vector<raft::command> commands = create_commands<int>(values);
co_await seastar::parallel_for_each(commands, [&] (raft::command cmd) {
co_await seastar::do_for_each(commands, [&] (raft::command cmd) {
tlogger.debug("Adding command entry on leader {}", leader);
return rafts[leader].first->add_entry(std::move(cmd), raft::wait_type::committed);
});
@@ -564,7 +564,7 @@ future<int> run_test(test_case test) {
std::iota(values.begin(), values.end(), next_val);
std::vector<raft::command> commands = create_commands<int>(values);
tlogger.debug("Adding remaining {} entries on leader {}", values.size(), leader);
co_await seastar::parallel_for_each(commands, [&] (raft::command cmd) {
co_await seastar::do_for_each(commands, [&] (raft::command cmd) {
return rafts[leader].first->add_entry(std::move(cmd), raft::wait_type::committed);
});
}