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

feat(cmapi): MCOL-6006 Disable failover when shared storage not detected

add Base api client
add NodeController api client
fix ClusterController Api client
add NodeController in endpoints.py
add 2 new endpoints to dispatcher: cluster/check-shared-storage and node/check-shared-file
add check_shared_storage method into ClusterHandler class
add set_shared_storage to node_manipulation t
add reading shared_storage in failover/config.py
fix is_shared_storage method in failover/config.py
add check_shared_storage in NodeMonitor class
fix some minor styling
This commit is contained in:
mariadb-AlanMologorsky
2025-07-18 16:00:34 +03:00
parent 7dca1da8f2
commit 48148b1e6e
10 changed files with 361 additions and 80 deletions

View File

@@ -59,6 +59,42 @@ def switch_node_maintenance(
# TODO: probably move publishing to cherrypy.engine failover channel here?
def set_shared_storage(
state: bool,
input_config_filename: str = DEFAULT_MCS_CONF_PATH,
output_config_filename: str = DEFAULT_MCS_CONF_PATH,
) -> bool:
"""Set shared storage state in Columnstore.xml.
:param state: state to set
:type state: bool
:param input_config_filename: mcs input config path,
defaults to DEFAULT_MCS_CONF_PATH
:type input_config_filename: str, optional
:param output_config_filename: mcs output config path,
defaults to DEFAULT_MCS_CONF_PATH
:return: True if new state to set is differ from state from Columnstore.xml
:rtype: bool
"""
current_state: str
node_config = NodeConfig()
config_root = node_config.get_current_config_root(input_config_filename)
shared_storage_element = config_root.find('SharedStorage')
if shared_storage_element is None:
shared_storage_element = etree.SubElement(config_root, 'SharedStorage')
else:
current_state = shared_storage_element.text
new_state = str(state).lower()
if current_state != new_state:
logging.debug(f'Shared storage state changed to {new_state!r}')
shared_storage_element.text = str(state).lower()
node_config.write_config(config_root, filename=output_config_filename)
return True
else:
# shared storage state not changed
return False
def add_node(
node: str, input_config_filename: str = DEFAULT_MCS_CONF_PATH,
output_config_filename: Optional[str] = None,