diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-22 08:26:28 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-10-22 08:26:28 +0300 |
commit | e3d692aa092a76415ce1ce0e9662338873d84abb (patch) | |
tree | c6c7fafc561b589f82ed3a0afd696822fd52962d /scripts | |
parent | 88d22f0e65192ca1b1e69b46661ce57ce19dbaa4 (diff) | |
parent | 620ea816adeceaba7c875679ab8505f4c07a22b8 (diff) | |
download | mariadb-git-e3d692aa092a76415ce1ce0e9662338873d84abb.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/convert-debug-for-diff.sh | 2 | ||||
-rw-r--r-- | scripts/mysql_system_tables_fix.sql | 12 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 54 | ||||
-rw-r--r-- | scripts/wsrep_sst_common.sh | 46 | ||||
-rw-r--r-- | scripts/wsrep_sst_mariabackup.sh | 67 |
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 3949cd8f072..a96c5279ba0 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -679,14 +679,14 @@ 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 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 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 password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER authentication_string; +ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER password_expired; +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 f40a68a3b1e..98398e5421f 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -428,25 +428,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 # @@ -454,28 +439,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 @@ -492,7 +477,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 573e747c55f..91f9831af1c 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -188,27 +188,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 @@ -526,25 +547,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 } @@ -704,9 +711,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=$WSREP_SST_OPT_MYSQLD |