setting tmp in my.cnf cause a crash of the cluster
General
Escalation
General
Escalation
Description
Hi,
the percona.operator inject a custom entrypoint inside the pxc, if i set inside my.cnf a custom tmpdir to have for example temp queries file into aws ebs of data_dir, the wrong flow of managing the tmp_dir by sst broke the status of the cluster.
[mysqld]tmp=/var/lib/mysql
If i set this, sst cancel the data_dir, so as workaround i have specified also sst section, so the entrypoint script can manage better this:
FROM percona/percona-xtradb-cluster:5.7.43
COPY initdir.sh /docker-entrypoint-initdb.d/
initdir.sh
#!/bin/bash
set -eo pipefail
shopt -s nullglob
set -o xtrace
_get_cnf_config() {
local group=$1
local var=${2//_/-}
local reval=""
reval=$(
my_print_defaults "${group}" \
| awk -F= '{st=index($0,"="); cur=$0; if ($1 ~ /_/) { gsub(/_/,"-",$1);} if (st != 0) { print $1"="substr(cur,st+1) } else { print cur }}' \
| grep -- "--$var=" \
| cut -d= -f2- \
| tail -1
)
if [[ -z $reval ]]; then
reval=$3
fi
echo "$reval"
}
tmpdir_path_sst=$(_get_cnf_config sst tmpdir "/var/lib/mysql/sst")
tmpdir_path=$(_get_cnf_config mysqld tmpdir "/var/lib/mysql/tmp")
for d in $tmpdir_path_sst $tmpdir_path; do
if [ ! -d $d ]; then
mkdir -p $d
fi
done
and a custom pxc-operator image that fix the rm of the sst working directory inside pxc-entrypoint passed into pxc.initImage parameter
FROM percona/percona-xtradb-cluster-operator:1.13.0
USER root
RUN sed -i -e 's/rm -rvf "${SST_DIR}" "${SST_P_FILE}"/& \&\& mkdir -p "${SST_DIR}"/' /pxc-entrypoint.sh
USER daemon
Environment
None
Activity
antonio falzarano March 21, 2024 at 3:56 PM
@Slava Sarzhan any news about this issue? also into 1.14.0 version this bug exists
Hi,
the percona.operator inject a custom entrypoint inside the pxc, if i set inside my.cnf a custom tmpdir to have for example temp queries file into aws ebs of data_dir, the wrong flow of managing the tmp_dir by sst broke the status of the cluster.
[mysqld] tmp=/var/lib/mysql
If i set this, sst cancel the data_dir, so as workaround i have specified also sst section, so the entrypoint script can manage better this:
[mysqld] tmpdir=/var/lib/mysql
[sst] tmpdir=/var/lib/mysql/tuotemp cpat='.*\\\.pem$\|.*init\\\.ok$\\\|.*galera\\\.cache$\\\|.*wsrep_recovery_verbose\\\.log$\\\|.*readiness-check\\\.sh$\\\|.*liveness-check\\\.sh$\\\|.*get-pxc-state$\\\|.*sst_in_progress$\\\|.*pmm-prerun\\\.sh$\\\|.*sst-xb-tmpdir$\\\|.*\.sst$\\\|.*gvwstate\\\.dat$\\\|.*grastate\\\.dat$\\\|.*\\\.err$\\\|.*\\\.log$\\\|.*RPM_UPGRADE_MARKER$\\\|.*RPM_UPGRADE_HISTORY$\\\|.*pxc-entrypoint\\\.sh$\\\|.*unsafe-bootstrap\\\.sh$\\\|.*pxc-configure-pxc\\\.sh\\\|.*peer-list$\\\|.*auth_plugin$\\\|.*tuotemp$'
Also setting this parameters, the cluster fail because there isn't a logic that create the sst dir as documentation want, instead the script when a new node going delete try to delete them, at this [line|https://github.com/percona/percona-xtradb-cluster-operator/blob/v1.13.0/build/pxc-entrypoint.sh#L499.]
Actually as workaround i have created a custom pxc image that create the sst dir:
FROM percona/percona-xtradb-cluster:5.7.43 COPY initdir.sh /docker-entrypoint-initdb.d/
initdir.sh
#!/bin/bash set -eo pipefail shopt -s nullglob set -o xtrace _get_cnf_config() { local group=$1 local var=${2//_/-} local reval="" reval=$( my_print_defaults "${group}" \ | awk -F= '{st=index($0,"="); cur=$0; if ($1 ~ /_/) { gsub(/_/,"-",$1);} if (st != 0) { print $1"="substr(cur,st+1) } else { print cur }}' \ | grep -- "--$var=" \ | cut -d= -f2- \ | tail -1 ) if [[ -z $reval ]]; then reval=$3 fi echo "$reval" } tmpdir_path_sst=$(_get_cnf_config sst tmpdir "/var/lib/mysql/sst") tmpdir_path=$(_get_cnf_config mysqld tmpdir "/var/lib/mysql/tmp") for d in $tmpdir_path_sst $tmpdir_path; do if [ ! -d $d ]; then mkdir -p $d fi done
and a custom pxc-operator image that fix the rm of the sst working directory inside pxc-entrypoint passed into pxc.initImage parameter
FROM percona/percona-xtradb-cluster-operator:1.13.0 USER root RUN sed -i -e 's/rm -rvf "${SST_DIR}" "${SST_P_FILE}"/& \&\& mkdir -p "${SST_DIR}"/' /pxc-entrypoint.sh USER daemon