Skip to content

MCOL-5964: support MCOL-5861 readonly nodes engine side #3519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 71 commits into
base: stable-23.10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
4213275
MCOL-5806: added ability to start node in read-only mode
mariadb-AlexanderPresniakov Mar 12, 2025
6325755
Part of review changes to retrigger package build
mariadb-AlexanderPresniakov Apr 1, 2025
c37a069
feat(cmapi): MCOL-5806 Review and rebase interface fixes.
mariadb-AlanMologorsky Apr 2, 2025
b76d2bc
Zero-diff to trigger package rebuild
mariadb-AlexanderPresniakov Apr 2, 2025
7bf82fe
Remove WES stop exclusion logic
mariadb-AlexanderPresniakov Apr 3, 2025
dc3af1f
Zero-diff to retrigger build
mariadb-AlexanderPresniakov Apr 3, 2025
7d56838
Add dbroots of other nodes to the read-only node
mariadb-AlexanderPresniakov Apr 18, 2025
2710690
Review fixes and ruff settings
mariadb-AlexanderPresniakov Apr 18, 2025
68d742d
Try not to create connection to WES if it was not enabled in the config
mariadb-AlexanderPresniakov Apr 7, 2025
dda3043
Do not throw an exception on missing dbroot
mariadb-AlexanderPresniakov Apr 14, 2025
244884b
Additional logging for install_mcs_mysql.sh
mariadb-AlexanderPresniakov Apr 14, 2025
1cd5f18
More review fixes
mariadb-AlexanderPresniakov Apr 23, 2025
47b65d7
Zero-diff to trigger build
mariadb-AlexanderPresniakov Apr 23, 2025
51a33f4
Restore edits after cherry-pick
mariadb-AlexanderPresniakov Apr 23, 2025
448b064
On every node change adjust dbroots in the read-only nodes
mariadb-AlexanderPresniakov Apr 25, 2025
edba5f6
Revert "More review fixes"
mariadb-SergeyZefirov Apr 29, 2025
d577831
Revert "Zero-diff to trigger build"
mariadb-SergeyZefirov Apr 29, 2025
377dcef
Revert "Restore edits after cherry-pick"
mariadb-SergeyZefirov Apr 29, 2025
4cd013a
Revert "On every node change adjust dbroots in the read-only nodes"
mariadb-SergeyZefirov Apr 29, 2025
7042057
Ready to test
mariadb-SergeyZefirov Apr 29, 2025
53b9086
A small fix
mariadb-SergeyZefirov May 5, 2025
1b43cbd
Bigger better fix for access to R/W nodes only
mariadb-SergeyZefirov May 5, 2025
7118b6c
Fix build
mariadb-SergeyZefirov May 5, 2025
30501fe
Fix build
mariadb-SergeyZefirov May 5, 2025
7e1b7e6
RW PM selection
mariadb-SergeyZefirov May 6, 2025
cd0fa95
debug logs
mariadb-SergeyZefirov May 16, 2025
6681284
debug logs
mariadb-SergeyZefirov May 16, 2025
0afbca8
Debug logs
mariadb-SergeyZefirov May 19, 2025
bbef995
Debug logs
mariadb-SergeyZefirov May 19, 2025
72f8094
Debug logs
mariadb-SergeyZefirov May 19, 2025
bd4e4e1
Debug logs
mariadb-SergeyZefirov May 20, 2025
8303560
Debug logs
mariadb-SergeyZefirov May 20, 2025
ec6b6d0
Debug logs
mariadb-SergeyZefirov May 20, 2025
254efc0
A fix???
mariadb-SergeyZefirov May 20, 2025
649558a
Debug logs
mariadb-SergeyZefirov May 20, 2025
5488356
Debug logs
mariadb-SergeyZefirov May 21, 2025
096f53a
Debug logs and ASAN
mariadb-SergeyZefirov May 21, 2025
170dba3
Off ASAN
mariadb-SergeyZefirov May 21, 2025
09f949a
A theory to test
mariadb-SergeyZefirov May 22, 2025
943041f
Enabling ASAN
mariadb-SergeyZefirov May 22, 2025
b45a8d5
Another way to enable ASAN
mariadb-SergeyZefirov May 23, 2025
d1f15a5
Enabling ASAN
mariadb-SergeyZefirov May 23, 2025
a736bdb
Disable ASAN; different recording logic
mariadb-SergeyZefirov May 23, 2025
f2a1877
Change fCatalogMap to vector
mariadb-SergeyZefirov May 27, 2025
c1010e4
Debug logs
mariadb-SergeyZefirov May 27, 2025
0283598
Debug logs
mariadb-SergeyZefirov May 27, 2025
9cde027
Debug logs
mariadb-SergeyZefirov May 28, 2025
8609301
Debug logs
mariadb-SergeyZefirov May 28, 2025
755115b
Debug logs
mariadb-SergeyZefirov May 28, 2025
f16172f
I need ASAN-ed build
mariadb-SergeyZefirov May 28, 2025
7933e8c
I need ASAN-ed build
mariadb-SergeyZefirov May 28, 2025
0a168a1
I need ASAN-ed build
mariadb-SergeyZefirov May 28, 2025
752e5e3
I need ASAN-ed build
mariadb-SergeyZefirov May 28, 2025
9baf9ac
I need ASAN-ed build
mariadb-SergeyZefirov May 28, 2025
4a51139
Try proper asan for rocky8 build
mariadb-LeonidFedorov May 28, 2025
0fdea5b
ASAN options in MDB config
mariadb-SergeyZefirov May 30, 2025
7ffa4a6
Debug logs, now in cmapi
mariadb-SergeyZefirov Jun 3, 2025
f016b3c
Debug logs, now in cmapi
mariadb-SergeyZefirov Jun 3, 2025
be7abde
Prevent detection of odr_violation in dbbuilder
mariadb-SergeyZefirov Jun 4, 2025
0a23598
Trying with ASAN off to look after BRM_saves_current file
mariadb-SergeyZefirov Jun 4, 2025
c97e319
Health check
mariadb-SergeyZefirov Jun 5, 2025
3249d59
Health checks
mariadb-SergeyZefirov Jun 5, 2025
a42d617
Health check
mariadb-SergeyZefirov Jun 5, 2025
fe5aded
Healths checks
mariadb-SergeyZefirov Jun 5, 2025
f4323dd
fix(scripts): dbbuilder did not start b\c of a typo
drrtuy Jun 6, 2025
63547b0
fix(): get rid of vector for syscat
drrtuy Jun 6, 2025
ea939aa
chore(build): fix pipeline (#3590)
mariadb-LeonidFedorov Jun 10, 2025
8c7b18b
chore(install): no more deps for awk and ps for postinstall script
mariadb-LeonidFedorov Jun 10, 2025
0a16d14
chore(packaging): add requires of snappy, ps awk and jemalloc required
mariadb-LeonidFedorov Jun 10, 2025
6d8f3d6
fix(asan): fix ASAN warnings spoted
drrtuy Jun 12, 2025
32c421f
chore(ci): downgrade amazon/aws-cli image in publish step to avoid aw…
mariadb-AlekseiBukhalov Jun 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
publish(step_prefix="pkg", eventp=event + "/${DRONE_BUILD_NUMBER}"):: {
name: "publish " + step_prefix,
depends_on: [std.strReplace(step_prefix, " latest", ""), "createrepo"],
image: "amazon/aws-cli",
image: "amazon/aws-cli:2.23.5",
when: {
status: ["success", "failure"],
},
Expand Down Expand Up @@ -271,7 +271,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
smoke:: {
name: "smoke",
depends_on: ["publish pkg"],
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.mdb, pipeline._volumes.docker],
commands: [
prepareTestStage(getContainerName("smoke"), result, true),
Expand All @@ -281,7 +281,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
smokelog:: {
name: "smokelog",
depends_on: ["smoke"],
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker, pipeline._volumes.mdb],
commands: [
reportTestStage(getContainerName("smoke"), result, "smoke"),
Expand All @@ -293,7 +293,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
upgrade(version):: {
name: "upgrade-test from " + version,
depends_on: ["regressionlog"],
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker],
environment: {
UPGRADE_TOKEN: {
Expand All @@ -314,7 +314,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
upgradelog:: {
name: "upgradelog",
depends_on: std.map(function(p) "upgrade-test from " + p, mdb_server_versions),
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker, pipeline._volumes.mdb],
commands:
["echo"] +
Expand Down Expand Up @@ -377,7 +377,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
mtrlog:: {
name: "mtrlog",
depends_on: ["mtr"],
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker, pipeline._volumes.mdb],
commands: [
reportTestStage(getContainerName("mtr"), result, "mtr"),
Expand Down Expand Up @@ -467,7 +467,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
regressionlog:: {
name: "regressionlog",
depends_on: [regression_tests[std.length(regression_tests) - 1]],
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker, pipeline._volumes.mdb],
commands: [
reportTestStage(getContainerName("regression"), result, "regression"),
Expand All @@ -480,7 +480,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
name: "dockerfile",
depends_on: ["publish pkg", "publish cmapi build"],
//failure: 'ignore',
image: "alpine/git",
image: "alpine/git:2.49.0",
environment: {
DOCKER_BRANCH_REF: "${DRONE_SOURCE_BRANCH}",
DOCKER_REF_AUX: branch_ref,
Expand Down Expand Up @@ -554,7 +554,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
cmapilog:: {
name: "cmapilog",
depends_on: ["cmapi test"],
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker, pipeline._volumes.mdb],
commands: [
reportTestStage(getContainerName("cmapi"), result, "cmapi"),
Expand All @@ -567,7 +567,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
name: "mtr",
depends_on: ["dockerhub"],
//failure: 'ignore',
image: "docker",
image: "docker:28.2.2",
volumes: [pipeline._volumes.docker],
environment: {
DOCKER_LOGIN: {
Expand Down Expand Up @@ -604,7 +604,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
steps: [
{
name: "submodules",
image: "alpine/git",
image: "alpine/git:2.49.0",
commands: [
"git submodule update --init --recursive",
"git config cmake.update-submodules no",
Expand All @@ -613,7 +613,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
},
{
name: "clone-mdb",
image: "alpine/git",
image: "alpine/git:2.49.0",
volumes: [pipeline._volumes.mdb],
environment: {
SERVER_REF: "${SERVER_REF:-" + server + "}",
Expand Down Expand Up @@ -662,7 +662,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
+ get_sccache
+ customEnvCommands(customBuildEnvCommandsMapKey, builddir) +
[
'bash -c "set -o pipefail && bash /mdb/' + builddir + "/storage/columnstore/columnstore/build/bootstrap_mcs.sh " +
'bash -c "set -o pipefail && bash /mdb/' + builddir + "/storage/columnstore/columnstore/build/bootstrap_mcs.sh " +
"--build-type RelWithDebInfo " +
"--distro " + platform + " " +
"--build-packages --install-deps --sccache " +
Expand Down Expand Up @@ -714,7 +714,7 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
{
name: "pkg",
depends_on: ["unittests"],
image: "alpine/git",
image: "alpine/git:2.49.0",
when: {
status: ["success", "failure"],
},
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ include(columnstore_version)
include(configureEngine)
include(compiler_flags)
include(misc)
include(cpack_manage)

set(COMPONENTS
dbcon/mysql
Expand Down
3 changes: 1 addition & 2 deletions build/bootstrap_mcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -742,8 +742,7 @@ if [[ $BUILD_PACKAGES = true ]]; then
modify_packaging
build_package
message_splitted "PACKAGES BUILD FINISHED"

return 0
exit 0
fi

stop_service
Expand Down
33 changes: 33 additions & 0 deletions cmake/cpack_manage.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
macro(columnstore_append_for_cpack var_name)
# Get current value from parent scope or use empty string
if(DEFINED ${var_name})
set(current_val "${${var_name}}")
else()
set(current_val "")
endif()

# Process each argument to append
foreach(arg IN LISTS ARGN)
if(current_val)
# If not empty, add comma before new item
set(current_val "${current_val}, ${arg}")
else()
# If empty, just add the item
set(current_val "${arg}")
endif()
endforeach()

# Set back in parent scope
set(${var_name}
"${current_val}"
PARENT_SCOPE
)
endmacro()

macro(columnstore_add_rpm_deps)
columnstore_append_for_cpack(CPACK_RPM_columnstore-engine_PACKAGE_REQUIRES ${ARGN})
endmacro()

if(RPM)
columnstore_add_rpm_deps("snappy" "jemalloc" "procps-ng" "gawk")
endif()
29 changes: 20 additions & 9 deletions cmapi/cmapi_server/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
import os
from typing import NamedTuple
from enum import Enum


# default MARIADB ColumnStore config path
Expand Down Expand Up @@ -53,6 +54,16 @@
CMAPI_INSTALL_PATH, 'cmapi_server/SingleNode.xml'
)

class MCSProgs(Enum):
STORAGE_MANAGER = 'StorageManager'
WORKER_NODE = 'workernode'
CONTROLLER_NODE = 'controllernode'
PRIM_PROC = 'PrimProc'
# EXE_MGR = 'ExeMgr'
WRITE_ENGINE_SERVER = 'WriteEngineServer'
DML_PROC = 'DMLProc'
DDL_PROC = 'DDLProc'

# constants for dispatchers
class ProgInfo(NamedTuple):
"""NamedTuple for some additional info about handling mcs processes."""
Expand All @@ -66,17 +77,17 @@ class ProgInfo(NamedTuple):
# on top level of process handling
# mcs-storagemanager starts conditionally inside mcs-loadbrm, but should be
# stopped using cmapi
ALL_MCS_PROGS = {
ALL_MCS_PROGS: dict[str, ProgInfo] = {
# workernode starts on primary and non primary node with 1 or 2 added
# to subcommand (DBRM_Worker1 - on primary, DBRM_Worker2 - non primary)
'StorageManager': ProgInfo(15, 'mcs-storagemanager', '', False, 1),
'workernode': ProgInfo(13, 'mcs-workernode', 'DBRM_Worker{}', False, 1),
'controllernode': ProgInfo(11, 'mcs-controllernode', 'fg', True),
'PrimProc': ProgInfo(5, 'mcs-primproc', '', False, 1),
'ExeMgr': ProgInfo(9, 'mcs-exemgr', '', False, 1),
'WriteEngineServer': ProgInfo(7, 'mcs-writeengineserver', '', False, 3),
'DMLProc': ProgInfo(3, 'mcs-dmlproc', '', False),
'DDLProc': ProgInfo(1, 'mcs-ddlproc', '', False),
MCSProgs.STORAGE_MANAGER.value: ProgInfo(15, 'mcs-storagemanager', '', False, 1),
MCSProgs.WORKER_NODE.value: ProgInfo(13, 'mcs-workernode', 'DBRM_Worker{}', False, 1),
MCSProgs.CONTROLLER_NODE.value: ProgInfo(11, 'mcs-controllernode', 'fg', True),
MCSProgs.PRIM_PROC.value: ProgInfo(5, 'mcs-primproc', '', False, 1),
# MCSProgs.EXE_MGR.value: ProgInfo(9, 'mcs-exemgr', '', False, 1),
MCSProgs.WRITE_ENGINE_SERVER.value: ProgInfo(7, 'mcs-writeengineserver', '', False, 3),
MCSProgs.DML_PROC.value: ProgInfo(3, 'mcs-dmlproc', '', False),
MCSProgs.DDL_PROC.value: ProgInfo(1, 'mcs-ddlproc', '', False),
}

# constants for docker container dispatcher
Expand Down
1 change: 1 addition & 0 deletions cmapi/cmapi_server/controllers/api_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def add_node(
: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(
Expand Down
20 changes: 15 additions & 5 deletions cmapi/cmapi_server/controllers/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ def put_config(self):
MCSProcessManager.stop_node(
is_primary=node_config.is_primary_node(),
use_sudo=use_sudo,
timeout=request_timeout
timeout=request_timeout,
is_read_only=node_config.is_read_only(),
)
except CMAPIBasicError as err:
raise_422_error(
Expand Down Expand Up @@ -463,6 +464,7 @@ def put_config(self):
MCSProcessManager.start_node(
is_primary=node_config.is_primary_node(),
use_sudo=use_sudo,
is_read_only=node_config.is_read_only(),
)
except CMAPIBasicError as err:
raise_422_error(
Expand Down Expand Up @@ -666,7 +668,8 @@ def put_start(self):
try:
MCSProcessManager.start_node(
is_primary=node_config.is_primary_node(),
use_sudo=use_sudo
use_sudo=use_sudo,
is_read_only=node_config.is_read_only(),
)
except CMAPIBasicError as err:
raise_422_error(
Expand Down Expand Up @@ -701,7 +704,8 @@ def put_shutdown(self):
MCSProcessManager.stop_node(
is_primary=node_config.is_primary_node(),
use_sudo=use_sudo,
timeout=timeout
timeout=timeout,
is_read_only=node_config.is_read_only(),
)
except CMAPIBasicError as err:
raise_422_error(
Expand Down Expand Up @@ -744,6 +748,9 @@ def get_brm_bytes(self, element:str):
ret = subprocess.run(args, stdout=subprocess.PIPE)
if ret.returncode != 0:
module_logger.warning(f"{func_name} got error code {ret.returncode} from smcat, retrying")
stderr = ret.stderr
module_logger.warning(f"{func_name} smcat stderr: {stderr}")
module_logger.warning(f"{func_name} smcat: {args}")
time.sleep(1)
retry_count += 1
continue
Expand All @@ -763,6 +770,8 @@ def get_brm_bytes(self, element:str):
ret = subprocess.run(args, stdout=subprocess.PIPE)
if ret.returncode != 0:
module_logger.warning(f"{func_name} got error code {ret.returncode} from smcat, retrying")
stderr = ret.stderr
module_logger.warning(f"{func_name} smcat stderr: {stderr}")
time.sleep(1)
retry_count += 1
continue
Expand Down Expand Up @@ -910,16 +919,17 @@ def put_add_node(self):
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')

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)

Expand Down
5 changes: 4 additions & 1 deletion cmapi/cmapi_server/failover_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def enterStandbyMode(self, test_mode = False):
try:
# TODO: remove test_mode condition and add mock for testing
if not test_mode:
MCSProcessManager.stop_node(is_primary=nc.is_primary_node())
MCSProcessManager.stop_node(
is_primary=nc.is_primary_node(),
is_read_only=nc.is_read_only(),
)
logger.info(
'FA.enterStandbyMode(): successfully stopped node.'
)
Expand Down
29 changes: 22 additions & 7 deletions cmapi/cmapi_server/handlers/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,19 @@ def shutdown(
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
:type node: str
: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
Expand All @@ -157,20 +162,30 @@ def add_node(node: str, config: str = DEFAULT_MCS_CONF_PATH) -> dict:
:rtype: dict
"""
logger: logging.Logger = logging.getLogger('cmapi_server')
logger.debug(f'Cluster add node command called. Adding node {node}.')
logger.debug(
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())}

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(
f'Node {node} is read-only, skipping dbroot addition'
)

except Exception as err:
raise CMAPIBasicError('Error while adding node.') from err

Expand Down
Loading