summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-10-22 13:27:18 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-10-22 13:27:18 +0300
commit46957a6a77518b579c6c8e1345666f84a5a59455 (patch)
treec0e463f14123cd09bb4d5854d32577e44b3a9827 /scripts
parent1619ae899099c4934f3b5919b2398c95a7cacc94 (diff)
parente3d692aa092a76415ce1ce0e9662338873d84abb (diff)
downloadmariadb-git-46957a6a77518b579c6c8e1345666f84a5a59455.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/convert-debug-for-diff.sh2
-rw-r--r--scripts/mysql_system_tables_fix.sql12
-rw-r--r--scripts/mysqld_safe.sh54
-rw-r--r--scripts/wsrep_sst_common.sh46
-rw-r--r--scripts/wsrep_sst_mariabackup.sh67
5 files changed, 107 insertions, 74 deletions
diff --git a/scripts/convert-debug-for-diff.sh b/scripts/convert-debug-for-diff.sh
index 60b328d946b..5b3ce05b815 100755
--- a/scripts/convert-debug-for-diff.sh
+++ b/scripts/convert-debug-for-diff.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -i
+#!/usr/bin/perl -i
#
# This script converts all numbers that look like addresses or memory sizes,
# in a debug files generated by --debug (like mysqld --debug-dbug), to #.
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index c68aa1e4103..758229618db 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -646,18 +646,18 @@ ALTER TABLE db modify Delete_history_priv enum('N','Y') COLLATE utf8_general_ci
UPDATE user SET Delete_history_priv = Super_priv WHERE @had_user_delete_history_priv = 0;
-ALTER TABLE user ADD plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
- ADD authentication_string TEXT NOT NULL;
+ALTER TABLE user ADD plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL AFTER max_user_connections,
+ ADD authentication_string TEXT NOT NULL AFTER plugin;
ALTER TABLE user CHANGE auth_string authentication_string TEXT NOT NULL;
ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
MODIFY authentication_string TEXT NOT NULL;
-ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER authentication_string;
ALTER TABLE user ADD password_last_changed timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL after password_expired;
ALTER TABLE user ADD password_lifetime smallint unsigned DEFAULT NULL after password_last_changed;
ALTER TABLE user ADD account_locked enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL after password_lifetime;
-ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
-ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL;
-ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;
+ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER account_locked;
+ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL AFTER is_role;
+ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL AFTER default_role;
-- Somewhere above, we ran ALTER TABLE user .... CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin.
-- we want password_expired column to have collation utf8_general_ci.
ALTER TABLE user MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 3dda22507af..6225b99276c 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -437,25 +437,10 @@ mysqld_ld_preload_text() {
echo "$text"
}
-
-mysql_config=
-get_mysql_config() {
- if [ -z "$mysql_config" ]; then
- mysql_config=`echo "$0" | sed 's,/[^/][^/]*$,/mysql_config,'`
- if [ ! -x "$mysql_config" ]; then
- log_error "Can not run mysql_config $@ from '$mysql_config'"
- exit 1
- fi
- fi
-
- "$mysql_config" "$@"
-}
-
-
# set_malloc_lib LIB
# - If LIB is empty, do nothing and return
-# - If LIB starts with 'tcmalloc' or 'jemalloc', look for the shared library in
-# /usr/lib, /usr/lib64 and then pkglibdir.
+# - If LIB starts with 'tcmalloc' or 'jemalloc', look for the shared library
+# using `ldconfig`.
# tcmalloc is part of the Google perftools project.
# - If LIB is an absolute path, assume it is a malloc shared library
#
@@ -463,28 +448,28 @@ get_mysql_config() {
# running mysqld. See ld.so for details.
set_malloc_lib() {
malloc_lib="$1"
-
if expr "$malloc_lib" : "\(tcmalloc\|jemalloc\)" > /dev/null ; then
- pkglibdir=`get_mysql_config --variable=pkglibdir`
- where=''
- # This list is kept intentionally simple. Simply set --malloc-lib
- # to a full path if another location is desired.
- for libdir in /usr/lib /usr/lib64 "$pkglibdir" "$pkglibdir/mysql"; do
- tmp=`echo "$libdir/lib$malloc_lib.so".[0-9]`
- where="$where $libdir"
- # log_notice "DEBUG: Checking for malloc lib '$tmp'"
- [ -r "$tmp" ] || continue
- malloc_lib="$tmp"
- where=''
- break
- done
+ if ! my_which ldconfig > /dev/null 2>&1
+ then
+ log_error "ldconfig command not found, required for ldconfig -p"
+ exit 1
+ fi
+ # format from ldconfig:
+ # "libjemalloc.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
+ libmalloc_path="$(ldconfig -p | sed -n "/lib${malloc_lib}/p" | cut -d '>' -f2)"
- if [ -n "$where" ]; then
- log_error "no shared library for lib$malloc_lib.so.[0-9] found in$where"
+ if [ -z "$libmalloc_path" ]; then
+ log_error "no shared library for lib$malloc_lib.so.[0-9] found."
exit 1
fi
- fi
+ for f in $libmalloc_path; do
+ if [ -f "$f" ]; then
+ malloc_lib=$f # get the first path if many
+ break
+ fi
+ done
+ fi
# Allow --malloc-lib='' to override other settings
[ -z "$malloc_lib" ] && return
@@ -501,7 +486,6 @@ set_malloc_lib() {
exit 1
;;
esac
-
add_mysqld_ld_preload "$malloc_lib"
}
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index 16607470f2c..5e134570881 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -45,28 +45,68 @@ case "$1" in
case "${WSREP_SST_OPT_ADDR}" in
\[*)
# IPv6
+ # Remove the starting and ending square brackets, if present:
addr_no_bracket=${WSREP_SST_OPT_ADDR#\[}
readonly WSREP_SST_OPT_HOST_UNESCAPED=${addr_no_bracket%%\]*}
+ # Square brackets are needed in most cases:
readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]"
+ # Some utilities and subsequent code require an address
+ # without square brackets:
readonly WSREP_SST_OPT_HOST_ESCAPED="\\[${WSREP_SST_OPT_HOST_UNESCAPED}\\]"
+ readonly WSREP_SST_OPT_HOST_IPv6=1
;;
*)
readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*}
readonly WSREP_SST_OPT_HOST_UNESCAPED=$WSREP_SST_OPT_HOST
readonly WSREP_SST_OPT_HOST_ESCAPED=$WSREP_SST_OPT_HOST
+ readonly WSREP_SST_OPT_HOST_IPv6=0
;;
esac
+ # Let's remove the leading part that contains the host address:
remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST_ESCAPED}}
+ # Let's remove the ":" character that separates the port number
+ # from the hostname:
remain=${remain#:}
+ # Extract the port number from the address - all characters
+ # up to "/" (if present):
readonly WSREP_SST_OPT_ADDR_PORT=${remain%%/*}
- remain=${remain#*/}
- readonly WSREP_SST_OPT_MODULE=${remain%%/*}
- readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/}
+ # If the "/" character is present, then the path is not empty:
+ if [ "${remain#*/}" != "${remain}" ]; then
+ # This operation removes everything up to the "/" character,
+ # effectively removing the port number from the string:
+ readonly WSREP_SST_OPT_PATH=${remain#*/}
+ else
+ readonly WSREP_SST_OPT_PATH=""
+ fi
+ # The rest of the string is the same as the path (for now):
+ remain=${WSREP_SST_OPT_PATH}
+ # If there is one more "/" in the string, then everything before
+ # it will be the module name, otherwise the module name is empty:
+ if [ "${remain%%/*}" != "${remain}" ]; then
+ # This operation removes the tail after the very first
+ # occurrence of the "/" character (inclusively):
+ readonly WSREP_SST_OPT_MODULE=${remain%%/*}
+ else
+ readonly WSREP_SST_OPT_MODULE=""
+ fi
+ # Remove the module name part from the string, which ends with "/":
remain=${WSREP_SST_OPT_PATH#*/}
+ # If the rest of the string does not match the original, then there
+ # was something else besides the module name:
if [ "$remain" != "${WSREP_SST_OPT_PATH}" ]; then
+ # Extract the part that matches the LSN by removing all
+ # characters starting from the very first "/":
readonly WSREP_SST_OPT_LSN=${remain%%/*}
+ # Exctract everything after the first occurrence of
+ # the "/" character in the string:
remain=${remain#*/}
+ # If the remainder does not match the original string,
+ # then there is something else (the version number in
+ # our case):
if [ "$remain" != "${WSREP_SST_OPT_LSN}" ]; then
+ # Let's extract the version number by removing the tail
+ # after the very first occurence of the "/" character
+ # (inclusively):
readonly WSREP_SST_OPT_SST_VER=${remain%%/*}
else
readonly WSREP_SST_OPT_SST_VER=""
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 15e5ebeacf0..181cd45cf44 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -186,27 +186,48 @@ get_transfer()
if nc -h 2>&1 | grep -q ncat;then
# Ncat
tcmd="nc -l ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
+ elif nc -h 2>&1 | grep -qw -- '-d\>';then
# Debian netcat
- tcmd="nc -dl ${TSST_PORT}"
+ if [ $WSREP_SST_OPT_HOST_IPv6 -eq 1 ];then
+ # When host is not explicitly specified (when only the port
+ # is specified) netcat can only bind to an IPv4 address if
+ # the "-6" option is not explicitly specified:
+ tcmd="nc -dl -6 ${TSST_PORT}"
+ else
+ tcmd="nc -dl ${TSST_PORT}"
+ fi
else
# traditional netcat
tcmd="nc -l -p ${TSST_PORT}"
fi
else
+ # Check to see if netcat supports the '-N' flag.
+ # -N Shutdown the network socket after EOF on stdin
+ # If it supports the '-N' flag, then we need to use the '-N'
+ # flag, otherwise the transfer will stay open after the file
+ # transfer and cause the command to timeout.
+ # Older versions of netcat did not need this flag and will
+ # return an error if the flag is used.
+ #
+ tcmd_extra=""
+ if nc -h 2>&1 | grep -qw -- -N; then
+ tcmd_extra+="-N"
+ wsrep_log_info "Using nc -N"
+ fi
+
+ # netcat doesn't understand [] around IPv6 address
if nc -h 2>&1 | grep -q ncat;then
# Ncat
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
- elif nc -h 2>&1 | grep -q -- '-d\>';then
+ wsrep_log_info "Using Ncat as streamer"
+ tcmd="nc ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
+ elif nc -h 2>&1 | grep -qw -- '-d\>';then
# Debian netcat
- if nc -h 2>&1 | grep -q -- '-N\>';then
- tcmd="nc -N ${REMOTEIP} ${TSST_PORT}"
- else
- tcmd="nc ${REMOTEIP} ${TSST_PORT}"
- fi
+ wsrep_log_info "Using Debian netcat as streamer"
+ tcmd="nc ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
else
# traditional netcat
- tcmd="nc -q0 ${REMOTEIP} ${TSST_PORT}"
+ wsrep_log_info "Using traditional netcat as streamer"
+ tcmd="nc -q0 ${tcmd_extra} ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}"
fi
fi
else
@@ -523,25 +544,11 @@ kill_xtrabackup()
setup_ports()
{
+ SST_PORT=${WSREP_SST_OPT_ADDR_PORT}
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; then
- remain=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\][:/]' '{ print $2 }')
- REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\]:' '{ print $1 }')"]"
- SST_PORT=$(echo $remain | awk -F '[:/]' '{ print $1 }')
- lsn=$(echo $remain | awk -F '[:/]' '{ print $3 }')
- sst_ver=$(echo $remain | awk -F '[:/]' '{ print $4 }')
- else
- SST_PORT=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $2 }')
- REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F ':' '{ print $1 }')
- lsn=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $4 }')
- sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }')
- fi
- else
- if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; then
- SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $2 }')
- else
- SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }')
- fi
+ REMOTEIP=${WSREP_SST_OPT_HOST}
+ lsn=${WSREP_SST_OPT_LSN}
+ sst_ver=${WSREP_SST_OPT_SST_VER}
fi
}
@@ -701,9 +708,11 @@ if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; t
disver="--no-version-check"
fi
+iopts+=" --databases-exclude=\"lost+found\""
+
if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then
wsrep_log_info "Forcing FTWRL due to environment variable FORCE_FTWRL equal to $FORCE_FTWRL"
- iopts+=" --no-backup-locks "
+ iopts+=" --no-backup-locks"
fi
INNOEXTRA=