Merge 'test/raft: use valid sentinel in liveness check to prevent digest errors' from Emil Maskovsky
Replace -1 with 0 for the liveness check operation to avoid triggering digest validation failures. This prevents rare fatal errors when the cluster is recovering and ensures the test does not violate append_seq invariants. The value -1 was causing invalid digest results in the append_seq structure, leading to assertion failures. This could happen when the sentinel value was the first (or only) element being appended, resulting in a digest that did not match the expected value. By using 0 instead, we ensure that the digest calculations remain valid and consistent with the expected behavior of the test. The specific value of the sentinel is not important, as long as it is a valid elem_t that does not violate the invariants of the append_seq structure. In particular, the sentinel value is typically used only when no valid result is received from any server in the current loop iteration, in which case the loop will retry. Fixes: scylladb/scylladb#27307 Backporting to active branches - this is a test-only fix (low risk) for a flaky test that exists in older branches (thus affects the CI of active branches). Closes scylladb/scylladb#28010 * https://github.com/scylladb/scylladb: test/raft: use valid sentinel in liveness check to prevent digest errors test/raft: improve debugging in randomized_nemesis_test
This commit is contained in:
@@ -2953,9 +2953,11 @@ public:
|
||||
check_digest_value(d);
|
||||
|
||||
auto y = (d + x) % magic;
|
||||
SCYLLA_ASSERT(digest_remove(y, x) == d);
|
||||
|
||||
validate_digest_value(y, d, x);
|
||||
|
||||
SCYLLA_ASSERT(digest_remove(y, x) == d);
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
@@ -3019,7 +3021,9 @@ public:
|
||||
|
||||
private:
|
||||
append_seq(lw_shared_ptr<std::vector<elem_t>> seq, size_t end, elem_t d)
|
||||
: _seq(std::move(seq)), _end(end), _digest(d) {}
|
||||
: _seq(std::move(seq)), _end(end), _digest(d) {
|
||||
check_digest_value(d);
|
||||
}
|
||||
};
|
||||
|
||||
struct AppendReg {
|
||||
@@ -3600,7 +3604,7 @@ SEASTAR_TEST_CASE(basic_generator_test) {
|
||||
tlogger.info("From the clients' point of view, the possible cluster members are: {}", known_config);
|
||||
|
||||
auto [res, last_attempted_server] = co_await bouncing{[&timer, &env] (raft::server_id id) {
|
||||
return env.call(id, AppendReg::append{-1}, timer.now() + 200_t, timer);
|
||||
return env.call(id, AppendReg::append{0}, timer.now() + 200_t, timer);
|
||||
}}(timer, known_config, leader, known_config.size() + 1, 10_t, 10_t);
|
||||
|
||||
if (std::holds_alternative<typename AppendReg::ret>(res)) {
|
||||
|
||||
Reference in New Issue
Block a user