test: Add test to check that a node does not fail on unknown commit status

error when starting up.

Test that a node is starting successfully if while joining a cluster and becoming a voter, it
receives an unknown commit status error.

Test for scylladb/scylladb#20814
This commit is contained in:
Sergey Zolotukhin
2025-01-10 17:49:42 +01:00
parent 775411ac56
commit 16053a86f0
2 changed files with 47 additions and 0 deletions

View File

@@ -857,6 +857,10 @@ future<add_entry_reply> server_impl::execute_modify_config(server_id from,
}
future<> server_impl::modify_config(std::vector<config_member> add, std::vector<server_id> del, seastar::abort_source* as) {
utils::get_local_injector().inject("raft/throw_commit_status_unknown_in_modify_config", [] {
throw raft::commit_status_unknown();
});
if (!_config.enable_forwarding) {
const auto leader = _fsm->current_leader();
if (leader != _id) {

View File

@@ -0,0 +1,43 @@
#
# Copyright (C) 2025-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
#
import logging
import pytest
import asyncio
import time
from cassandra import ConsistencyLevel # type: ignore
from cassandra.query import SimpleStatement # type: ignore
from test.pylib.manager_client import ManagerClient
from test.pylib.util import wait_for_cql_and_get_hosts
logger = logging.getLogger(__name__)
@pytest.mark.xfail(reason="issue #20814")
@pytest.mark.asyncio
async def test_error_while_becoming_voter(request: pytest.FixtureRequest, manager: ManagerClient) -> None:
"""
Test that a node is starting successfully if while joining a cluster and becoming a voter, it
receives an unknown commit status error.
Issue https://github.com/scylladb/scylladb/issues/20814
1. Create a new cluster, start 2 nodes normally.
2. Run one node with error injection for throwing an exception commit_status_unknown in modify_config,
so that after bootstrapping the node would get a commit_status_unknown error.
3. Make sure the node was started successfully. In case the error with the handling of commit_status_unknown is
not handled properly, the node will fail to start.
"""
logger.info("Creating a new cluster")
await manager.servers_add(2)
srv = await manager.server_add(config={
"error_injections_at_startup": [
{"name": "raft/throw_commit_status_unknown_in_modify_config", "one_shot": True}
]
})
await manager.server_start(srv.server_id)