[info=fae3046e80c478fb6656de3f8dc10bf8]

OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/mariadb-image?expand=0&rev=68
This commit is contained in:
Dan Čermák 2024-06-13 14:33:30 +00:00 committed by Git OBS Bridge
parent d28ae6a194
commit 0388952195
3 changed files with 33 additions and 32 deletions

View File

@ -95,7 +95,7 @@ docker_process_init_files() {
done done
} }
# arguments necessary to run "mysqld --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values) # arguments necessary to run "mariadbd --verbose --help" successfully (used for testing configuration validity and for extracting default/configured values)
_verboseHelpArgs=( _verboseHelpArgs=(
--verbose --help --verbose --help
) )
@ -103,12 +103,12 @@ _verboseHelpArgs=(
mysql_check_config() { mysql_check_config() {
local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors local toRun=( "$@" "${_verboseHelpArgs[@]}" ) errors
if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then if ! errors="$("${toRun[@]}" 2>&1 >/dev/null)"; then
mysql_error $'mysqld failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors" mysql_error $'mariadbd failed while attempting to check config\n\tcommand was: '"${toRun[*]}"$'\n\t'"$errors"
fi fi
} }
# Fetch value from server config # Fetch value from server config
# We use mysqld --verbose --help instead of my_print_defaults because the # We use mariadbd --verbose --help instead of my_print_defaults because the
# latter only show values present in config files, and not server defaults # latter only show values present in config files, and not server defaults
mysql_get_config() { mysql_get_config() {
local conf="$1"; shift local conf="$1"; shift
@ -122,7 +122,6 @@ docker_temp_server_start() {
"$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" --wsrep_on=OFF \ "$@" --skip-networking --default-time-zone=SYSTEM --socket="${SOCKET}" --wsrep_on=OFF \
--expire-logs-days=0 \ --expire-logs-days=0 \
--loose-innodb_buffer_pool_load_at_startup=0 \ --loose-innodb_buffer_pool_load_at_startup=0 \
--skip-ssl --ssl-cert='' --ssl-key='' --ssl-ca='' \
& &
declare -g MARIADB_PID declare -g MARIADB_PID
MARIADB_PID=$! MARIADB_PID=$!
@ -136,7 +135,6 @@ docker_temp_server_start() {
local i local i
for i in {30..0}; do for i in {30..0}; do
if docker_process_sql "${extraArgs[@]}" --database=mysql \ if docker_process_sql "${extraArgs[@]}" --database=mysql \
--skip-ssl --skip-ssl-verify-server-cert \
<<<'SELECT 1' &> /dev/null; then <<<'SELECT 1' &> /dev/null; then
break break
fi fi
@ -147,7 +145,7 @@ docker_temp_server_start() {
fi fi
} }
# Stop the server. When using a local socket file mysqladmin will block until # Stop the server. When using a local socket file mariadb-admin will block until
# the shutdown is complete. # the shutdown is complete.
docker_temp_server_stop() { docker_temp_server_stop() {
kill "$MARIADB_PID" kill "$MARIADB_PID"
@ -222,14 +220,14 @@ docker_create_db_directories() {
} }
_mariadb_version() { _mariadb_version() {
echo -n "%%MARIADB_VERSION_BASIC%%-MariaDB" echo -n "11.2.3-MariaDB"
} }
# initializes the database directory # initializes the database directory
docker_init_database_dir() { docker_init_database_dir() {
mysql_note "Initializing database files" mysql_note "Initializing database files"
installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal ) installArgs=( --datadir="$DATADIR" --rpm --auth-root-authentication-method=normal )
# "Other options are passed to mysqld." (so we pass all "mysqld" arguments directly here) # "Other options are passed to mariadbd." (so we pass all "mariadbd" arguments directly here)
local mariadbdArgs=() local mariadbdArgs=()
for arg in "${@:2}"; do for arg in "${@:2}"; do
@ -240,7 +238,7 @@ docker_init_database_dir() {
mariadbdArgs+=("$arg") mariadbdArgs+=("$arg")
fi fi
done done
mysql_install_db "${installArgs[@]}" "${mariadbdArgs[@]}" \ mariadb-install-db "${installArgs[@]}" "${mariadbdArgs[@]}" \
--skip-test-db \ --skip-test-db \
--old-mode='UTF8_IS_UTF8MB3' \ --old-mode='UTF8_IS_UTF8MB3' \
--default-time-zone=SYSTEM --enforce-storage-engine= \ --default-time-zone=SYSTEM --enforce-storage-engine= \
@ -298,7 +296,7 @@ docker_exec_client() {
if [ -n "$MYSQL_DATABASE" ]; then if [ -n "$MYSQL_DATABASE" ]; then
set -- --database="$MYSQL_DATABASE" "$@" set -- --database="$MYSQL_DATABASE" "$@"
fi fi
mysql --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@" mariadb --protocol=socket -uroot -hlocalhost --socket="${SOCKET}" "$@"
} }
# Execute sql script, passed via stdin # Execute sql script, passed via stdin
@ -366,7 +364,7 @@ docker_setup_db() {
# --skip-write-binlog usefully disables binary logging # --skip-write-binlog usefully disables binary logging
# but also outputs LOCK TABLES to improve the IO of # but also outputs LOCK TABLES to improve the IO of
# Aria (MDEV-23326) for 10.4+. # Aria (MDEV-23326) for 10.4+.
mysql_tzinfo_to_sql --skip-write-binlog /usr/share/zoneinfo \ mariadb-tzinfo-to-sql --skip-write-binlog /usr/share/zoneinfo \
| docker_process_sql --dont-use-mysql-root-password --database=mysql | docker_process_sql --dont-use-mysql-root-password --database=mysql
# tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet # tell docker_process_sql to not use MYSQL_ROOT_PASSWORD since it is not set yet
fi fi
@ -523,7 +521,7 @@ docker_mariadb_init()
if [ -f "$DATADIR/.init/backup-my.cnf" ]; then if [ -f "$DATADIR/.init/backup-my.cnf" ]; then
mv "$DATADIR/.init/backup-my.cnf" "$DATADIR/.my.cnf" mv "$DATADIR/.init/backup-my.cnf" "$DATADIR/.my.cnf"
mysql_note "Adding startup configuration:" mysql_note "Adding startup configuration:"
my_print_defaults --defaults-file="$DATADIR/.my.cnf" --mysqld my_print_defaults --defaults-file="$DATADIR/.my.cnf" --mariadbd
fi fi
rm -rf "$DATADIR"/.init "$DATADIR"/.restore rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then if [ "$(id -u)" = "0" ]; then
@ -573,15 +571,15 @@ docker_mariadb_backup_system()
fi fi
local backup_db="system_mysql_backup_unknown_version.sql.zst" local backup_db="system_mysql_backup_unknown_version.sql.zst"
local oldfullversion="unknown_version" local oldfullversion="unknown_version"
if [ -r "$DATADIR"/mysql_upgrade_info ]; then if [ -r "$DATADIR"/mariadb_upgrade_info ]; then
read -r -d '' oldfullversion < "$DATADIR"/mysql_upgrade_info || true read -r -d '' oldfullversion < "$DATADIR"/mariadb_upgrade_info || true
if [ -n "$oldfullversion" ]; then if [ -n "$oldfullversion" ]; then
backup_db="system_mysql_backup_${oldfullversion}.sql.zst" backup_db="system_mysql_backup_${oldfullversion}.sql.zst"
fi fi
fi fi
mysql_note "Backing up system database to $backup_db" mysql_note "Backing up system database to $backup_db"
if ! mysqldump --skip-lock-tables --replace --databases mysql --socket="${SOCKET}" | zstd > "${DATADIR}/${backup_db}"; then if ! mariadb-dump --skip-lock-tables --replace --databases mysql --socket="${SOCKET}" | zstd > "${DATADIR}/${backup_db}"; then
mysql_error "Unable backup system database for upgrade from $oldfullversion." mysql_error "Unable backup system database for upgrade from $oldfullversion."
fi fi
mysql_note "Backing up complete" mysql_note "Backing up complete"
@ -592,7 +590,7 @@ docker_mariadb_backup_system()
docker_mariadb_upgrade() { docker_mariadb_upgrade() {
if [ -z "$MARIADB_AUTO_UPGRADE" ] \ if [ -z "$MARIADB_AUTO_UPGRADE" ] \
|| [ "$MARIADB_AUTO_UPGRADE" = 0 ]; then || [ "$MARIADB_AUTO_UPGRADE" = 0 ]; then
mysql_note "MariaDB upgrade (mysql_upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting" mysql_note "MariaDB upgrade (mariadb-upgrade or creating healthcheck users) required, but skipped due to \$MARIADB_AUTO_UPGRADE setting"
return return
fi fi
mysql_note "Starting temporary server" mysql_note "Starting temporary server"
@ -631,7 +629,7 @@ EOSQL
fi fi
mysql_note "Starting mariadb-upgrade" mysql_note "Starting mariadb-upgrade"
mysql_upgrade --upgrade-system-tables mariadb-upgrade --upgrade-system-tables
mysql_note "Finished mariadb-upgrade" mysql_note "Finished mariadb-upgrade"
mysql_note "Stopping temporary server" mysql_note "Stopping temporary server"
@ -641,14 +639,14 @@ EOSQL
_check_if_upgrade_is_needed() { _check_if_upgrade_is_needed() {
if [ ! -f "$DATADIR"/mysql_upgrade_info ]; then if [ ! -f "$DATADIR"/mariadb_upgrade_info ]; then
mysql_note "MariaDB upgrade information missing, assuming required" mysql_note "MariaDB upgrade information missing, assuming required"
return 0 return 0
fi fi
local mariadbVersion local mariadbVersion
mariadbVersion="$(_mariadb_version)" mariadbVersion="$(_mariadb_version)"
IFS='.-' read -ra newversion <<<"$mariadbVersion" IFS='.-' read -ra newversion <<<"$mariadbVersion"
IFS='.-' read -ra oldversion < "$DATADIR"/mysql_upgrade_info || true IFS='.-' read -ra oldversion < "$DATADIR"/mariadb_upgrade_info || true
if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \ if [[ ${#newversion[@]} -lt 2 ]] || [[ ${#oldversion[@]} -lt 2 ]] \
|| [[ ${oldversion[0]} -lt ${newversion[0]} ]] \ || [[ ${oldversion[0]} -lt ${newversion[0]} ]] \
@ -663,7 +661,7 @@ _check_if_upgrade_is_needed() {
return 1 return 1
} }
# check arguments for an option that would cause mysqld to stop # check arguments for an option that would cause mariadbd to stop
# return true if there is one # return true if there is one
_mysql_want_help() { _mysql_want_help() {
local arg local arg
@ -678,9 +676,9 @@ _mysql_want_help() {
} }
_main() { _main() {
# if command starts with an option, prepend mysqld # if command starts with an option, prepend mariadbd
if [ "${1:0:1}" = '-' ]; then if [ "${1:0:1}" = '-' ]; then
set -- mysqld "$@" set -- mariadbd "$@"
fi fi
#ENDOFSUBSTITUTIONS #ENDOFSUBSTITUTIONS
@ -705,7 +703,7 @@ _main() {
docker_mariadb_init "$@" docker_mariadb_init "$@"
# MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline # MDEV-27636 mariadb_upgrade --check-if-upgrade-is-needed cannot be run offline
#elif mysql_upgrade --check-if-upgrade-is-needed; then #elif mariadb-upgrade --check-if-upgrade-is-needed; then
elif _check_if_upgrade_is_needed; then elif _check_if_upgrade_is_needed; then
docker_mariadb_upgrade "$@" docker_mariadb_upgrade "$@"
fi fi

View File

@ -10,8 +10,8 @@
# the --replication option. This allows a different set of replication checks # the --replication option. This allows a different set of replication checks
# on different connections. # on different connections.
# #
# --su{=|-mysql} is option to run the healthcheck as a different unix user. # --su{=|-mariadb} is option to run the healthcheck as a different unix user.
# Useful if mysql@localhost user exists with unix socket authentication # Useful if mariadb@localhost user exists with unix socket authentication
# Using this option disregards previous options set, so should usually be the # Using this option disregards previous options set, so should usually be the
# first option. # first option.
# #
@ -26,7 +26,7 @@
# replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+) # replication REPLICATION_CLIENT (<10.5)or REPLICA MONITOR (10.5+)
# mariadbupgrade none, however unix user permissions on datadir # mariadbupgrade none, however unix user permissions on datadir
# #
# The SQL user used is the default for the mysql client. This can be the unix user # The SQL user used is the default for the mariadb client. This can be the unix user
# if no user(or password) is set in the [mariadb-client] section of a configuration # if no user(or password) is set in the [mariadb-client] section of a configuration
# file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration # file. --defaults-{file,extra-file,group-suffix} can specify a file/configuration
# different from elsewhere. # different from elsewhere.
@ -38,11 +38,10 @@ set -eo pipefail
_process_sql() _process_sql()
{ {
mysql ${nodefaults:+--no-defaults} \ mariadb ${nodefaults:+--no-defaults} \
${def['file']:+--defaults-file=${def['file']}} \ ${def['file']:+--defaults-file=${def['file']}} \
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \ ${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \ ${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
--skip-ssl --skip-ssl-verify-server-cert \
-B "$@" -B "$@"
} }
@ -59,11 +58,10 @@ connect()
set +e +o pipefail set +e +o pipefail
# (on second extra_file) # (on second extra_file)
# shellcheck disable=SC2086 # shellcheck disable=SC2086
mysql ${nodefaults:+--no-defaults} \ mariadb ${nodefaults:+--no-defaults} \
${def['file']:+--defaults-file=${def['file']}} \ ${def['file']:+--defaults-file=${def['file']}} \
${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \ ${def['extra_file']:+--defaults-extra-file=${def['extra_file']}} \
${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \ ${def['group_suffix']:+--defaults-group-suffix=${def['group_suffix']}} \
--skip-ssl --skip-ssl-verify-server-cert \
-h localhost --protocol tcp -e 'select 1' 2>&1 \ -h localhost --protocol tcp -e 'select 1' 2>&1 \
| grep -qF "Can't connect" | grep -qF "Can't connect"
local ret=${PIPESTATUS[1]} local ret=${PIPESTATUS[1]}
@ -201,11 +199,11 @@ replication()
# mariadbupgrade # mariadbupgrade
# #
# Test the lock on the file $datadir/mysql_upgrade_info # Test the lock on the file $datadir/mariadb_upgrade_info
# https://jira.mariadb.org/browse/MDEV-27068 # https://jira.mariadb.org/browse/MDEV-27068
mariadbupgrade() mariadbupgrade()
{ {
local f="$datadir/mysql_upgrade_info" local f="$datadir/mariadb_upgrade_info"
if [ -r "$f" ]; then if [ -r "$f" ]; then
flock --exclusive --nonblock -n 9 9<"$f" flock --exclusive --nonblock -n 9 9<"$f"
return $? return $?

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jun 13 14:30:53 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- switch to the flavored entrypoint scripts from upstream
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jun 12 07:10:29 UTC 2024 - Dirk Mueller <dmueller@suse.com> Wed Jun 12 07:10:29 UTC 2024 - Dirk Mueller <dmueller@suse.com>