From 1ab262e86ba88c19b157c33da0c7347a449c59ab Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Sun, 17 Jan 2021 11:51:47 +0200 Subject: [PATCH] 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> --- test/raft/replication_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/raft/replication_test.cc b/test/raft/replication_test.cc index 57b1103102..f369f0ff63 100644 --- a/test/raft/replication_test.cc +++ b/test/raft/replication_test.cc @@ -483,7 +483,7 @@ future run_test(test_case test) { std::vector values(n); std::iota(values.begin(), values.end(), next_val); std::vector commands = create_commands(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 run_test(test_case test) { std::iota(values.begin(), values.end(), next_val); std::vector commands = create_commands(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); }); }