You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
feat(cmapi): MCOL-5806 Review and rebase interface fixes.
* feat(cmapi): add read_only param for API add node endpoint * style(cmapi): fixes for string length and quotes
This commit is contained in:
committed by
Alexander Presnyakov
parent
9a1ac0eb74
commit
93cd9354a9
@@ -68,6 +68,7 @@ class ClusterControllerClient:
|
||||
:param node_info: Information about the node to add.
|
||||
:return: The response from the API.
|
||||
"""
|
||||
#TODO: fix interface as in remove_node used or think about universal
|
||||
return self._request('PUT', 'node', {**node_info, **extra})
|
||||
|
||||
def remove_node(
|
||||
|
@@ -914,6 +914,7 @@ class ClusterController:
|
||||
node = request_body.get('node', None)
|
||||
config = request_body.get('config', DEFAULT_MCS_CONF_PATH)
|
||||
in_transaction = request_body.get('in_transaction', False)
|
||||
read_only = request_body.get('read_only', False)
|
||||
|
||||
if node is None:
|
||||
raise_422_error(module_logger, func_name, 'missing node argument')
|
||||
@@ -921,9 +922,9 @@ class ClusterController:
|
||||
try:
|
||||
if not in_transaction:
|
||||
with TransactionManager(extra_nodes=[node]):
|
||||
response = ClusterHandler.add_node(node, config)
|
||||
response = ClusterHandler.add_node(node, config, read_only)
|
||||
else:
|
||||
response = ClusterHandler.add_node(node, config)
|
||||
response = ClusterHandler.add_node(node, config, read_only)
|
||||
except CMAPIBasicError as err:
|
||||
raise_422_error(module_logger, func_name, err.message)
|
||||
|
||||
|
@@ -163,8 +163,8 @@ class ClusterHandler():
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug(
|
||||
'Cluster add node command called. '
|
||||
f'Adding node {node} in {"read-only" if read_only else "read-write"} mode.'
|
||||
f'Cluster add node command called. Adding node {node} in '
|
||||
f'{"read-only" if read_only else "read-write"} mode.'
|
||||
)
|
||||
|
||||
response = {'timestamp': str(datetime.now())}
|
||||
@@ -182,7 +182,9 @@ class ClusterHandler():
|
||||
output_config_filename=config
|
||||
)
|
||||
else:
|
||||
logger.debug(f"Node {node} is read-only, skipping dbroot addition")
|
||||
logger.debug(
|
||||
f'Node {node} is read-only, skipping dbroot addition'
|
||||
)
|
||||
|
||||
except Exception as err:
|
||||
raise CMAPIBasicError('Error while adding node.') from err
|
||||
|
@@ -543,7 +543,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")]
|
||||
return [node.text for node in root.findall('./ReadOnlyNodes/Node')]
|
||||
|
||||
|
||||
def in_maintenance_state(config=DEFAULT_MCS_CONF_PATH):
|
||||
|
@@ -100,7 +100,7 @@ def add_node(
|
||||
if not read_only:
|
||||
_add_WES(c_root, pm_num, node)
|
||||
else:
|
||||
logging.info("Node is read-only, skipping WES addition")
|
||||
logging.info('Node is read-only, skipping WES addition.')
|
||||
_add_read_only_node(c_root, node)
|
||||
|
||||
_add_DBRM_Worker(c_root, node)
|
||||
@@ -112,7 +112,9 @@ def add_node(
|
||||
_rebalance_dbroots(c_root)
|
||||
_move_primary_node(c_root)
|
||||
else:
|
||||
logging.debug("Node is read-only, skipping dbroots rebalancing")
|
||||
logging.debug(
|
||||
'Node is read-only, skipping dbroots rebalancing.'
|
||||
)
|
||||
except Exception:
|
||||
logging.error(
|
||||
'Caught exception while adding node, config file is unchanged',
|
||||
|
Reference in New Issue
Block a user