Files
scylladb/test/cluster/test_boot_after_ip_change.py
Benny Halevy c62865df90 db/config: add tablets_mode_for_new_keyspaces option
The new option deprecates the existing `enable_tablets` option.
It will be extended in the next patch with a 3rd value: "enforced"
while will enable tablets by default for new keyspace but
without the posibility to opt out using the `tablets = {'enabled':
false}` keyspace schema option.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2025-03-24 14:54:45 +02:00

53 lines
2.1 KiB
Python

#
# Copyright (C) 2023-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
#
import time
import pytest
import logging
from test.pylib.manager_client import ManagerClient
from test.cluster.util import wait_for_token_ring_and_group0_consistency
logger = logging.getLogger(__name__)
@pytest.mark.asyncio
async def test_boot_after_ip_change(manager: ManagerClient) -> None:
"""Bootstrap a new node after existing one changed its IP.
Regression test for #14468. Does not apply to Raft-topology mode.
"""
cfg = {'enable_user_defined_functions': False,
'force_gossip_topology_changes': True,
'tablets_mode_for_new_keyspaces': 'disabled'}
logger.info(f"Booting initial cluster")
servers = [await manager.server_add(config=cfg) for _ in range(2)]
await wait_for_token_ring_and_group0_consistency(manager, time.time() + 30)
logger.info(f"Stopping server {servers[1]}")
await manager.server_stop_gracefully(servers[1].server_id)
logger.info(f"Changing IP of server {servers[1]}")
new_ip = await manager.server_change_ip(servers[1].server_id)
servers[1] = servers[1]._replace(ip_addr = new_ip)
logger.info(f"New IP: {new_ip}")
logger.info(f"Restarting server {servers[1]}")
await manager.server_start(servers[1].server_id)
# We need to do this wait before we boot a new node.
# Otherwise the newly booting node may contact servers[0] even before servers[0]
# saw the new IP of servers[1], and then the booting node will try to wait
# for servers[1] to be alive using its old IP (and eventually time out).
#
# Note that this still acts as a regression test for #14468.
# In #14468, the problem was that a booting node would try to wait for the old IP
# of servers[0] even after all existing servers saw the IP change.
logger.info(f"Wait until {servers[0]} sees the new IP of {servers[1]}")
await manager.server_sees_other_server(servers[0].ip_addr, servers[1].ip_addr)
logger.info(f"Booting new node")
await manager.server_add(config=cfg)