You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-11-05 04:50:35 +03:00
Implements the initial upgrade capability across CMAPI and the CLI, including
repository setup, package operations, environment prechecks, and coordinated
cluster steps with progress reporting.
Details:
- CMAPI upgrade manager:
- Add `cmapi/cmapi_server/managers/upgrade/` modules:
- `repo.py`, `packages.py`, `preinstall.py`, `upgrade.py`, `utils.py` and `__init__.py`
- Extend endpoints and routing to expose upgrade operations and status:
- `cmapi_server/controllers/{endpoints.py, dispatcher.py, api_clients.py}`
- `cmapi_server/managers/{application.py, process.py}`
- Add improved constants and helpers for upgrade flow
- Backup/restore and safety:
- Add `cmapi_server/managers/backup_restore.py`
- Fix pre-upgrade backup regressions (due to `mcs_backup_manager.sh 3.17 changes`)
- Improve cluster version validation; add `ignore_missmatch` override
- CLI enhancements:
- Progress UI and richer feedback (`mcs_cluster_tool/tools_commands.py`, `README.md`, `mcs.1`)
- Add steps to start MDB and start MCS during/after upgrade
- Improved error surfacing for version validation
- Platform and packaging:
- Ubuntu and Rocky Linux support
- RHEL/DNF dry-run support
- Distro detection and platform-dependent logic hardened
- Logging improvements
- Updater service:
- Add `cmapi/updater/cmapi_updater.service.template` and `cmapi_updater.sh` to make CMAPI update itself
- Docs:
- Update mcs cli README and mcs.1 man file
- Add `cmapi/updater/README.md`
55 lines
2.1 KiB
Python
55 lines
2.1 KiB
Python
import logging
|
|
import re
|
|
|
|
from cmapi_server.exceptions import CMAPIBasicError
|
|
from cmapi_server.process_dispatchers.base import BaseDispatcher
|
|
|
|
|
|
class PreInstallManager:
|
|
|
|
@staticmethod
|
|
def check_gtid_strict_mode():
|
|
"""
|
|
Check if gtid_strict_mode is enabled in MariaDB/MySQL configuration.
|
|
Throw an error if gtid_strict_mode=1 is found.
|
|
|
|
TODO: seems to be useless if set dynamically using
|
|
SET GLOBAL gtid_strict_mode = 1;
|
|
Better solution is to use query SELECT @@global.gtid_strict_mode;
|
|
But need to investigate how to implement it if no crossengine
|
|
user set, may be check it and fallback or just throw an error.
|
|
"""
|
|
cmd: str = 'my_print_defaults --mysqld'
|
|
success, cmd_output = BaseDispatcher.exec_command(cmd)
|
|
if not success:
|
|
if not cmd_output:
|
|
logging.debug(
|
|
'my_print_defaults not found. Ensure gtid_strict_mode=0.'
|
|
)
|
|
else:
|
|
logging.debug(
|
|
'my_print_defaults --mysqld command call returns an '
|
|
f'error: {cmd_output}. Ensure gtid_strict_mode=0.'
|
|
)
|
|
else:
|
|
# Search for gtid_strict_mode or gtid-strict-mode patterns
|
|
gtid_pattern = re.compile(r"gtid[-_]strict[-_]mode")
|
|
strict_mode_lines = [
|
|
line for line in cmd_output.splitlines()
|
|
if gtid_pattern.search(line)
|
|
]
|
|
if strict_mode_lines:
|
|
# Check if any line shows gtid_strict_mode=1
|
|
for line in strict_mode_lines:
|
|
line = line.strip()
|
|
if (
|
|
line == '--gtid_strict_mode=1' or
|
|
line == '--gtid_strict_mode=ON'
|
|
):
|
|
message = (
|
|
'gtid strick mode is ON, need to be off before '
|
|
'upgrade/downgrade.'
|
|
)
|
|
logging.error(message)
|
|
raise CMAPIBasicError(message)
|