1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-08 14:22:09 +03:00

Part of review changes to retrigger package build

This commit is contained in:
Alexander Presnyakov
2025-04-01 14:51:52 +00:00
parent 37453ad47e
commit 9a1ac0eb74
4 changed files with 22 additions and 7 deletions

View File

@@ -95,7 +95,10 @@ class FailoverAgent(AgentBase):
try:
# TODO: remove test_mode condition and add mock for testing
if not test_mode:
MCSProcessManager.stop_node(is_primary=nc.is_primary_node(), is_read_only=nc.is_read_only())
MCSProcessManager.stop_node(
is_primary=nc.is_primary_node(),
is_read_only=nc.is_read_only(),
)
logger.info(
'FA.enterStandbyMode(): successfully stopped node.'
)

View File

@@ -162,7 +162,10 @@ class ClusterHandler():
:rtype: dict
"""
logger: logging.Logger = logging.getLogger('cmapi_server')
logger.debug('Cluster add node command called. Adding node %s in %s mode.', node, 'read-only' if read_only else 'read-write')
logger.debug(
'Cluster add node command called. '
f'Adding node {node} in {"read-only" if read_only else "read-write"} mode.'
)
response = {'timestamp': str(datetime.now())}
@@ -179,7 +182,7 @@ class ClusterHandler():
output_config_filename=config
)
else:
logger.debug("Node %s is read-only, skipping dbroot addition", node)
logger.debug(f"Node {node} is read-only, skipping dbroot addition")
except Exception as err:
raise CMAPIBasicError('Error while adding node.') from err

View File

@@ -542,6 +542,7 @@ def get_desired_nodes(config=DEFAULT_MCS_CONF_PATH):
def get_read_only_nodes(root) -> list[str]:
"""Get names of read-only nodes from config"""
return [node.text for node in root.findall("./ReadOnlyNodes/Node")]
@@ -603,8 +604,8 @@ def get_dbroots(node, config=DEFAULT_MCS_CONF_PATH):
)
if dbroots and nc.is_read_only():
logger = logging.getLogger("dbroots")
logger.warning("Config contains dbroots %s for this read-only node, ignoring", dbroots)
logger = logging.getLogger('dbroots')
logger.warning(f'Config contains dbroots {dbroots} for this read-only node, ignoring')
return []
return dbroots

View File

@@ -405,7 +405,12 @@ class MCSProcessManager:
return set(node_progs) == set(p['name'] for p in running_procs)
@classmethod
def start_node(cls, is_primary: bool, use_sudo: bool = True, is_read_only: bool = False) -> None:
def start_node(
cls,
is_primary: bool,
use_sudo: bool = True,
is_read_only: bool = False,
) -> None:
"""Start mcs node processes.
:param is_primary: is node primary or not, defaults to True
@@ -431,7 +436,10 @@ class MCSProcessManager:
cls._wait_for_workernodes()
if prog_name in (MCSProgs.DML_PROC.value, MCSProgs.DDL_PROC.value):
cls._wait_for_controllernode()
if is_read_only and prog_name == MCSProgs.WRITE_ENGINE_SERVER.value:
if (
is_read_only and
prog_name == MCSProgs.WRITE_ENGINE_SERVER.value
):
logging.debug('Node is in read-only mode, not starting WriteEngine')
continue
if not cls.start(prog_name, is_primary, use_sudo):