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
MCOL-5806: added ability to start node in read-only mode
This commit is contained in:
@@ -139,7 +139,10 @@ class ClusterHandler():
|
||||
return {'timestamp': operation_start_time}
|
||||
|
||||
@staticmethod
|
||||
def add_node(node: str, config: str = DEFAULT_MCS_CONF_PATH) -> dict:
|
||||
def add_node(
|
||||
node: str, config: str = DEFAULT_MCS_CONF_PATH,
|
||||
read_only: bool = False,
|
||||
) -> dict:
|
||||
"""Method to add node to MCS CLuster.
|
||||
|
||||
:param node: node IP or name or FQDN
|
||||
@@ -147,6 +150,8 @@ class ClusterHandler():
|
||||
:param config: columnstore xml config file path,
|
||||
defaults to DEFAULT_MCS_CONF_PATH
|
||||
:type config: str, optional
|
||||
:param read_only: add node in read-only mode, defaults to False
|
||||
:type read_only: bool, optional
|
||||
:raises CMAPIBasicError: on exception while starting transaction
|
||||
:raises CMAPIBasicError: if transaction start isn't successful
|
||||
:raises CMAPIBasicError: on exception while adding node
|
||||
@@ -157,20 +162,25 @@ class ClusterHandler():
|
||||
:rtype: dict
|
||||
"""
|
||||
logger: logging.Logger = logging.getLogger('cmapi_server')
|
||||
logger.debug(f'Cluster add node command called. Adding node {node}.')
|
||||
logger.debug('Cluster add node command called. Adding node %s in %s mode.', node, 'read-only' if read_only else 'read-write')
|
||||
|
||||
response = {'timestamp': str(datetime.now())}
|
||||
|
||||
try:
|
||||
add_node(
|
||||
node, input_config_filename=config,
|
||||
output_config_filename=config
|
||||
output_config_filename=config,
|
||||
read_only=read_only,
|
||||
)
|
||||
if not get_dbroots(node, config):
|
||||
add_dbroot(
|
||||
host=node, input_config_filename=config,
|
||||
output_config_filename=config
|
||||
)
|
||||
if not read_only: # Read-only nodes don't own dbroots
|
||||
add_dbroot(
|
||||
host=node, input_config_filename=config,
|
||||
output_config_filename=config
|
||||
)
|
||||
else:
|
||||
logger.debug("Node %s is read-only, skipping dbroot addition", node)
|
||||
|
||||
except Exception as err:
|
||||
raise CMAPIBasicError('Error while adding node.') from err
|
||||
|
||||
|
Reference in New Issue
Block a user