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

fix(cmapi): MCOL-6091 CMAPI gives DMLProc only 10 seconds for a greceful stop

Fix default timeout for stop node, stop dml proc, shutdown Controller, put_config handler etc.
All places that could cause reducing dmlproc graceful stop timeout are fixed:
- cluster and node shutdown
- stop_dmlproc
- start_transaction
- put_config
- toggle_cluster_state
This commit is contained in:
mariadb-AlanMologorsky
2025-10-17 15:53:39 +03:00
committed by Alan Mologorsky
parent 63415f28d0
commit c5e3b847ab
8 changed files with 98 additions and 49 deletions

View File

@@ -27,8 +27,15 @@ from cmapi_server.exceptions import CMAPIBasicError
requests.packages.urllib3.disable_warnings() # pylint: disable=no-member
from cmapi_server.constants import (
CMAPI_CONF_PATH, CMAPI_DEFAULT_CONF_PATH, DEFAULT_MCS_CONF_PATH,
DEFAULT_SM_CONF_PATH, LOCALHOSTS, _version
CMAPI_CONF_PATH,
CMAPI_DEFAULT_CONF_PATH,
DEFAULT_MCS_CONF_PATH,
DEFAULT_SM_CONF_PATH,
DMLPROC_SHUTDOWN_TIMEOUT,
LOCALHOSTS,
LONG_REQUEST_TIMEOUT,
TRANSACTION_TIMEOUT,
_version
)
from cmapi_server.handlers.cej import CEJPasswordHandler
from cmapi_server.managers.process import MCSProcessManager
@@ -54,7 +61,7 @@ def start_transaction(
remove_nodes: Optional[list] = None,
optional_nodes: Optional[list] = None,
txn_id: Optional[int] = None,
timeout: float = 300.0
timeout: float = TRANSACTION_TIMEOUT
):
"""Start internal CMAPI transaction.
@@ -78,7 +85,7 @@ def start_transaction(
:param txn_id: id for transaction to start, defaults to None
:type txn_id: Optional[int], optional
:param timeout: time in seconds for cmapi transaction lock before it ends
automatically, defaults to 300
automatically, defaults to TRANSACTION_TIMEOUT
:type timeout: float, optional
:return: (success, txn_id, nodes)
:rtype: tuple[bool, int, list[str]]
@@ -315,8 +322,7 @@ def broadcast_new_config(
defaults to DEFAULT_SM_CONF_PATH
:param test_mode: for test purposes, defaults to False TODO: remove
:param nodes: nodes list for config put, defaults to None
:param timeout: timeout passing to gracefully stop DMLProc TODO: for next
releases. Could affect all logic of broadcacting new config
:param timeout: timeout passing to gracefully stop DMLProc process,
:param distribute_secrets: flag to distribute secrets to nodes
:param stateful_config_dict: stateful config update dict to distribute to nodes
:raises CMAPIBasicError: If Broadcasting config to nodes failed with errors
@@ -332,7 +338,7 @@ def broadcast_new_config(
headers = {'x-api-key': key}
if stateful_config_dict:
body = {
'timeout': 300,
'timeout': DMLPROC_SHUTDOWN_TIMEOUT if timeout is None else timeout,
'stateful_config_dict': stateful_config_dict,
'only_stateful_config': True,
}
@@ -348,7 +354,7 @@ def broadcast_new_config(
body = {
'manager': root.find('./ClusterManager').text,
'revision': root.find('./ConfigRevision').text,
'timeout': 300,
'timeout': DMLPROC_SHUTDOWN_TIMEOUT if timeout is None else timeout,
'config': config_text,
'mcs_config_filename': cs_config_filename,
'sm_config_filename': sm_config_filename,
@@ -386,7 +392,7 @@ def broadcast_new_config(
async with create_traced_async_session() as session:
try:
async with session.put(
url, headers=headers, json=body, ssl=False, timeout=120
url, headers=headers, json=body, ssl=False, timeout=LONG_REQUEST_TIMEOUT
) as response:
resp_json = await response.json(encoding='utf-8')
response.raise_for_status()