diff --git a/raft/server.cc b/raft/server.cc index 2a745d3828..e85f8862a4 100644 --- a/raft/server.cc +++ b/raft/server.cc @@ -857,6 +857,10 @@ future server_impl::execute_modify_config(server_id from, } future<> server_impl::modify_config(std::vector add, std::vector 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) { diff --git a/test/topology_custom/test_error_becoming_voter.py b/test/topology_custom/test_error_becoming_voter.py new file mode 100644 index 0000000000..745ba68de8 --- /dev/null +++ b/test/topology_custom/test_error_becoming_voter.py @@ -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)