[info=602a8e1c04951facb4281e553b641d25]

OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/mariadb-image?expand=0&rev=106
This commit is contained in:
Dan Čermák 2024-08-09 08:19:07 +00:00 committed by Git OBS Bridge
parent 9560d14a27
commit cf8c13a723
3 changed files with 36 additions and 9 deletions

View File

@ -206,9 +206,11 @@ docker_create_db_directories() {
if [ "$user" = "0" ]; then if [ "$user" = "0" ]; then
# this will cause less disk access than `chown -R` # this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' + find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -true \)
# See https://github.com/MariaDB/mariadb-docker/issues/363 # See https://github.com/MariaDB/mariadb-docker/issues/363
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql -exec chown mysql: '{}' \; if [ "${SOCKET:0:1}" != '@' ]; then # not abstract sockets
find "${SOCKET%/*}" -maxdepth 0 \! -user mysql \( -exec chown mysql: '{}' \; -o -true \)
fi
# memory.pressure # memory.pressure
local cgroup; cgroup=$(</proc/self/cgroup) local cgroup; cgroup=$(</proc/self/cgroup)
@ -355,7 +357,7 @@ create_healthcheck_users() {
local maskPreserve local maskPreserve
maskPreserve=$(umask -p) maskPreserve=$(umask -p)
umask 0077 umask 0077
echo -e "[mariadb-client]\\nport=$PORT\\nsocket=$SOCKET\\nuser=healthcheck\\npassword=$healthCheckConnectPass\\nprotocol=tcp\\n" > "$DATADIR"/.my-healthcheck.cnf echo -e "[mariadb-client]\\nport=$PORT\\nsocket=$SOCKET\\nuser=healthcheck\\npassword=$healthCheckConnectPass\\n" > "$DATADIR"/.my-healthcheck.cnf
$maskPreserve $maskPreserve
} }
@ -528,7 +530,7 @@ docker_mariadb_init()
rm -rf "$DATADIR"/.init "$DATADIR"/.restore rm -rf "$DATADIR"/.init "$DATADIR"/.restore
if [ "$(id -u)" = "0" ]; then if [ "$(id -u)" = "0" ]; then
# this will cause less disk access than `chown -R` # this will cause less disk access than `chown -R`
find "$DATADIR" \! -user mysql -exec chown mysql: '{}' + find "$DATADIR" \! -user mysql \( -exec chown mysql: '{}' + -o -true \)
fi fi
done done
if _check_if_upgrade_is_needed; then if _check_if_upgrade_is_needed; then

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{=|-mariadb} is option to run the healthcheck as a different unix user. # --su{=|-mysql} is option to run the healthcheck as a different unix user.
# Useful if mariadb@localhost user exists with unix socket authentication # Useful if mysql@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.
# #
@ -32,7 +32,7 @@
# different from elsewhere. # different from elsewhere.
# #
# Note * though denied error message will result in error log without # Note * though denied error message will result in error log without
# any permissions. # any permissions. USAGE recommend to avoid this.
set -eo pipefail set -eo pipefail
@ -43,6 +43,7 @@ _process_sql()
${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 \ --skip-ssl --skip-ssl-verify-server-cert \
--protocol socket \
-B "$@" -B "$@"
} }
@ -56,6 +57,16 @@ _process_sql()
# isn't tested. # isn't tested.
connect() connect()
{ {
local s
# short cut mechanism, to work with --require-secure-transport
s=$(_process_sql --skip-column-names -e 'select @@skip_networking')
case "$s" in
0|1)
connect_s=$s
return "$s";
;;
esac
# falling back to this if there wasn't a connection answer.
set +e +o pipefail set +e +o pipefail
# (on second extra_file) # (on second extra_file)
# shellcheck disable=SC2086 # shellcheck disable=SC2086
@ -70,9 +81,11 @@ connect()
set -eo pipefail set -eo pipefail
if (( "$ret" == 0 )); then if (( "$ret" == 0 )); then
# grep Matched "Can't connect" so we fail # grep Matched "Can't connect" so we fail
return 1 connect_s=1
else
connect_s=0
fi fi
return 0 return $connect_s
} }
# INNODB_INITIALIZED # INNODB_INITIALIZED
@ -227,6 +240,7 @@ fi
declare -A repl declare -A repl
declare -A def declare -A def
nodefaults= nodefaults=
connect_s=
datadir=/var/lib/mysql datadir=/var/lib/mysql
if [ -f $datadir/.my-healthcheck.cnf ]; then if [ -f $datadir/.my-healthcheck.cnf ]; then
def['extra_file']=$datadir/.my-healthcheck.cnf def['extra_file']=$datadir/.my-healthcheck.cnf
@ -353,3 +367,9 @@ while [ $# -gt 0 ]; do
fi fi
shift shift
done done
if [ -z "$connect_s" ]; then
# we didn't do a connnect test, so the current success status is suspicious
# return what connect thinks.
connect
exit $?
fi

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Aug 9 08:05:26 UTC 2024 - Dirk Mueller <dmueller@suse.com>
- update entry point scripts from git
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Aug 8 19:28:10 UTC 2024 - Dirk Mueller <dmueller@suse.com> Thu Aug 8 19:28:10 UTC 2024 - Dirk Mueller <dmueller@suse.com>