diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/CMakeLists.txt | 37 | ||||
-rw-r--r-- | scripts/mysql_install_db.sh | 28 | ||||
-rw-r--r-- | scripts/mysql_system_tables.sql | 6 | ||||
-rw-r--r-- | scripts/mysql_zap.sh | 172 | ||||
-rw-r--r-- | scripts/mysqlaccess.sh | 2 | ||||
-rw-r--r-- | scripts/mysqlbug.sh | 406 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 39 | ||||
-rw-r--r-- | scripts/wsrep_sst_common.sh | 5 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 115 |
9 files changed, 104 insertions, 706 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index d960f792a95..2ef2a1758f7 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -134,42 +134,6 @@ ENDIF() SET(HOSTNAME "hostname") SET(MYSQLD_USER "mysql") - -# Required for mysqlbug until autotools are deprecated, once done remove these -# and expand default cmake variables -SET(CC ${CMAKE_C_COMPILER}) -SET(CXX ${CMAKE_CXX_COMPILER}) -SET(SAVE_CC ${CMAKE_C_COMPILER}) -SET(SAVE_CXX ${CMAKE_CXX_COMPILER}) -SET(SAVE_CFLAGS ${CFLAGS}) -SET(SAVE_CXXFLAGS ${CXXFLAGS}) -# XXX no cmake equivalent for this, just make one up -SET(CONFIGURE_LINE "Built using CMake") - -# Also required for mysqlbug, autoconf only supports --version so for now we -# just explicitly require GNU -EXECUTE_PROCESS( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} --version - COMMAND sed 1q - ERROR_QUIET - OUTPUT_VARIABLE CC_VERSION) -EXECUTE_PROCESS( - COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} --version - COMMAND sed 1q - ERROR_QUIET - OUTPUT_VARIABLE CXX_VERSION) - -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqlbug.sh - ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug ESCAPE_QUOTES @ONLY) - EXECUTE_PROCESS( - COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/mysqlbug - ) - -INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/mysqlbug - DESTINATION ${INSTALL_BINDIR} - COMPONENT Server - ) - ENDIF(UNIX) # Really ugly, one script, "mysql_install_db", needs prefix set to ".", @@ -281,7 +245,6 @@ ELSE() IF (NOT WITHOUT_SERVER) SET(SERVER_SCRIPTS mysql_fix_extensions - mysql_zap mysqld_multi mysqld_safe mysqldumpslow diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 364cc4fb9e0..f8f4859e627 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -29,6 +29,7 @@ args="" defaults="" mysqld_opt="" user="" +silent_startup="--silent-startup" force=0 in_rpm=0 @@ -141,7 +142,7 @@ parse_arguments() # where a chown of datadir won't help) user=`parse_arg "$arg"` ;; --skip-name-resolve) ip_only=1 ;; - --verbose) verbose=1 ;; # Obsolete + --verbose) verbose=1 ; silent_startup="" ;; --rpm) in_rpm=1 ;; --help) usage ;; --no-defaults|--defaults-file=*|--defaults-extra-file=*) @@ -449,7 +450,7 @@ fi mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}" mysqld_install_cmd_line() { - "$mysqld_bootstrap" $defaults "$mysqld_opt" --bootstrap \ + "$mysqld_bootstrap" $defaults "$mysqld_opt" --bootstrap $silent_startup\ "--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --enforce-storage-engine="" \ $args --max_allowed_packet=8M \ --net_buffer_length=16K @@ -468,7 +469,7 @@ SET @auth_root_socket=NULL;" ;; SET @skip_auth_root_nopasswd=1; SET @auth_root_socket='$auth_root_socket_user';" ;; esac -if { echo "use mysql;$install_params"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null +if { echo "use mysql;$install_params"; cat "$create_system_tables" "$create_system_tables2" "$fill_system_tables" "$fill_help_tables" "$maria_add_gis_sp"; } | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null then s_echo "OK" else @@ -503,27 +504,6 @@ else exit 1 fi -s_echo "Filling help tables..." -if { echo "use mysql;"; cat "$fill_help_tables"; } | mysqld_install_cmd_line > /dev/null -then - s_echo "OK" -else - echo - echo "WARNING: HELP FILES ARE NOT COMPLETELY INSTALLED!" - echo "The \"HELP\" command might not work properly." -fi - -s_echo "Creating OpenGIS required SP-s..." -if { echo "use mysql;"; cat "$maria_add_gis_sp"; } | mysqld_install_cmd_line > /dev/null -then - s_echo "OK" -else - echo - echo "WARNING: OPENGIS REQUIRED SP-S WERE NOT COMPLETELY INSTALLED!" - echo "GIS extentions might not work properly." -fi - - # Don't output verbose information if running inside bootstrap or using # --srcdir for testing. In such cases, there's no end user looking at # the screen. diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index f7d277544de..7b614163f46 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -237,3 +237,9 @@ EXECUTE stmt; DROP PREPARE stmt; set storage_engine=@orig_storage_engine; + +-- +-- Drop some tables not used anymore in MariaDB +--- + +drop table if exists mysql.ndb_binlog_index; diff --git a/scripts/mysql_zap.sh b/scripts/mysql_zap.sh deleted file mode 100644 index 98c3603df15..00000000000 --- a/scripts/mysql_zap.sh +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/perl -# Copyright (c) 2000-2002, 2004, 2006 MySQL AB, 2009 Sun Microsystems, Inc. -# Use is subject to license terms. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# This is a utility for MariaDB. It is not needed by any standard part -# of MariaDB. - -# Usage: mysql_zap [-signal] [-f] [-t] pattern - -# Configuration parameters. - -$sig = ""; # Default to try all signals -$ans = "y"; -$opt_f= 0; -$opt_t= 0; -$opt_a = ""; - -$BSD = -f '/vmunix' || $ENV{"OS"} eq "SunOS4"; -$LINUX = $^O eq 'linux' || $^O eq 'darwin'; -$pscmd = $BSD ? "/bin/ps -auxww" : $LINUX ? "/bin/ps axuw" : "/bin/ps -ef"; - -open(TTYIN, "</dev/tty") || die "can't read /dev/tty: $!"; -open(TTYOUT, ">/dev/tty") || die "can't write /dev/tty: $!"; -select(TTYOUT); -$| = 1; -select(STDOUT); -$SIG{'INT'} = 'cleanup'; - -while ($#ARGV >= $[ && $ARGV[0] =~ /^-/) { - if ($ARGV[0] =~ /(ZERO|HUP|INT|QUIT|ILL|TRAP|ABRT|EMT|FPE|KILL|BUS|SEGV|SYS|PIPE|ALRM|TERM|URG|STOP|TSTP|CONT|CLD|TTIN|TTOU|IO|XCPU|XFSZ|VTALRM|PROF|WINCH|LOST|USR1|USR2)/ || $ARGV[0] =~ /-(\d+)$/) { - $sig = $1; - } elsif ($ARGV[0] eq "-f") { - $opt_f=1; - } elsif ($ARGV[0] eq "-t") { - $opt_t=1; - $ans = "n"; - } - elsif ($ARGV[0] eq "-a") - { - $opt_a = 1; - } - elsif ($ARGV[0] eq "-?" || $ARGV[0] eq "-I" || $ARGV[0] eq "--help") - { - &usage; - } - else { - print STDERR "$0: illegal argument $ARGV[0] ignored\n"; - } - shift; -} - -&usage if $#ARGV < 0; - -if (!$opt_f) -{ - if ($BSD) { - system "stty cbreak </dev/tty >/dev/tty 2>&1"; - } - else { - system "stty", 'cbreak', - system "stty", 'eol', '^A'; - } -} - -open(PS, "$pscmd|") || die "can't run $pscmd: $!"; -$title = <PS>; -print TTYOUT $title; - -# Catch any errors with eval. A bad pattern, for instance. -eval <<'EOF'; -process: while ($cand = <PS>) -{ - chop($cand); - ($user, $pid) = split(' ', $cand); - next if $pid == $$; - $found = !@ARGV; - if ($opt_a) { $found = 1; } - foreach $pat (@ARGV) - { - if ($opt_a) - { - if (! ($cand =~ $pat)) - { - next process; - } - } - else - { - $found = 1 if $cand =~ $pat; - } - } - next if (!$found); - if (! $opt_f && ! $opt_t) - { - print TTYOUT "$cand? "; - read(TTYIN, $ans, 1); - print TTYOUT "\n" if ($ans ne "\n"); - } - else - { - print TTYOUT "$cand\n"; - } - if ($ans =~ /^y/i) { &killpid($sig, $pid); } - if ($ans =~ /^q/i) { last; } -} -EOF - -&cleanup; - - -sub usage { - print <<EOF; -Usage: $0 [-signal] [-?Ift] [--help] pattern -Options: -I or -? "info" -f "force" -t "test". - -Version 1.0 -Kill processes that match the pattern. -If -f isn't given, ask user for confirmation for each process to kill. -If signal isn't given, try first with signal 15, then with signal 9. -If -t is given, the processes are only shown on stdout. -EOF - exit(1); -} - -sub cleanup { - if ($BSD) { - system "stty -cbreak </dev/tty >/dev/tty 2>&1"; - } - else { - system "stty", 'icanon'; - system "stty", 'eol', '^@'; - } - print "\n"; - exit; -} - -sub killpid { - local($signal,$pid) = @_; - if ($signal) - { - kill $signal,$pid; - } - else - { - print "kill -15\n"; - kill 15, $pid; - for (1..5) { - sleep 2; - return if kill(0, $pid) == 0; - } - print "kill -9\n"; - kill 9, $pid; - for (1..5) { - sleep 2; - return if kill(0, $pid) == 0; - } - print "$pid will not die!\n"; - } -} diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index a7cc2eccf38..59d1bded245 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -262,7 +262,7 @@ Release Notes: * default values are read from a configuration file $script.conf first this file is looked for in the current directory; if not found it is looked for in @sysconfdir@ - Note that when default-values are given, these can't get overriden + Note that when default-values are given, these can't get overridden by empty (blanc) values! * CGI-BIN version with HTML and forms interface. Simply place the script in an ScriptAliased directory, make the configuration file diff --git a/scripts/mysqlbug.sh b/scripts/mysqlbug.sh deleted file mode 100644 index e9df210fa84..00000000000 --- a/scripts/mysqlbug.sh +++ /dev/null @@ -1,406 +0,0 @@ -#!/bin/sh -# Copyright (C) 2000-2002, 2004 MySQL AB -# Use is subject to license terms -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -# Create a bug report and mail it to the mysql mailing list -# Based on glibc bug reporting script. - -echo "Finding system information for a MySQL bug report" - -VERSION="@VERSION@@MYSQL_SERVER_SUFFIX@" -COMPILATION_COMMENT="@COMPILATION_COMMENT@" -BUGmysql="maria-developers@lists.launchpad.net" -# This is set by configure -COMP_CALL_INFO="CC='@SAVE_CC@' CFLAGS='@SAVE_CFLAGS@' CXX='@SAVE_CXX@' CXXFLAGS='@SAVE_CXXFLAGS@' LDFLAGS='@SAVE_LDFLAGS@' ASFLAGS='@SAVE_ASFLAGS@'" -COMP_RUN_INFO="CC='@CC@' CFLAGS='@CFLAGS@' CXX='@CXX@' CXXFLAGS='@CXXFLAGS@' LDFLAGS='@LDFLAGS@' ASFLAGS='@ASFLAGS@'" -CONFIGURE_LINE="@CONF_COMMAND@" - -LIBC_INFO="" -for pat in /lib/libc.* /lib/libc-* /usr/lib/libc.* /usr/lib/libc-* -do - TMP=`ls -l $pat 2>/dev/null` - if test $? = 0 - then - LIBC_INFO="$LIBC_INFO -$TMP" - fi -done - -PATH=../client:$PATH:/bin:/usr/bin:/usr/local/bin -export PATH - -BUGADDR=${1-$BUGmysql} -ENVIRONMENT=`uname -a` - -: ${USER=${LOGNAME-`whoami`}} - -COMMAND=`echo $0|sed 's%.*/\([^/]*\)%\1%'` - -# Try to create a secure tmpfile -umask 077 -TEMPDIR=/tmp/mysqlbug-$$ -mkdir $TEMPDIR || (echo "can not create directory in /tmp, aborting"; exit 1;) -TEMP=${TEMPDIR}/mysqlbug - -trap 'rm -f $TEMP $TEMP.x; rmdir $TEMPDIR; exit 1' 1 2 3 13 15 -trap 'rm -f $TEMP $TEMP.x; rmdir $TEMPDIR' 0 - -# How to read the passwd database. -PASSWD="cat /etc/passwd" - -if test -f /usr/lib/sendmail -then - MAIL_AGENT="/usr/lib/sendmail -oi -t" -elif test -f /usr/sbin/sendmail -then - MAIL_AGENT="/usr/sbin/sendmail -oi -t" -else - MAIL_AGENT="rmail $BUGmysql" -fi - -# Figure out how to echo a string without a trailing newline -N=`echo 'hi there\c'` -case "$N" in - *c) ECHON1='echo -n' ECHON2= ;; - *) ECHON1=echo ECHON2='\c' ;; -esac - -# Find out the name of the originator of this PR. -if test -n "$NAME" -then - ORIGINATOR="$NAME" -elif test -f $HOME/.fullname -then - ORIGINATOR="`sed -e '1q' $HOME/.fullname`" -else - # Must use temp file due to incompatibilities in quoting behavior - # and to protect shell metacharacters in the expansion of $LOGNAME - $PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP - ORIGINATOR="`cat $TEMP`" - rm -f $TEMP -fi - -if test -n "$ORGANIZATION" -then - if test -f "$ORGANIZATION" - then - ORGANIZATION="`cat $ORGANIZATION`" - fi -else - if test -f $HOME/.organization - then - ORGANIZATION="`cat $HOME/.organization`" - elif test -f $HOME/.signature - then - ORGANIZATION=`sed -e "s/^/ /" $HOME/.signature; echo ">"` - fi -fi - -PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` - -which_1 () -{ - for cmd - do - # Absolute path ?. - if expr "x$cmd" : "x/" > /dev/null - then - echo "$cmd" - exit 0 - else - for d in $PATH_DIRS - do - file="$d/$cmd" - if test -x "$file" -a ! -d "$file" - then - echo "$file" - exit 0 - fi - done - fi - done - exit 1 -} - -change_editor () -{ - echo "You can change editor by setting the environment variable VISUAL." - echo "If your shell is a bourne shell (sh) do" - echo "VISUAL=your_editors_name; export VISUAL" - echo "If your shell is a C shell (csh) do" - echo "setenv VISUAL your_editors_name" -} - -# If they don't have a preferred editor set, then use emacs -if test -z "$VISUAL" -then - if test -z "$EDITOR" - then - # Honor debian sensible-editor - if test -x "/usr/bin/sensible-editor" - then - EDIT=/usr/bin/sensible-editor - else - EDIT=emacs - fi - else - EDIT="$EDITOR" - fi -else - EDIT="$VISUAL" -fi - -#which_1 $EDIT -used_editor=`which_1 $EDIT` - -echo "test -x $used_editor" -if test -x "$used_editor" -then - echo "Using editor $used_editor"; - change_editor - sleep 2 -else - echo "Could not find a text editor. (tried $EDIT)" - change_editor - exit 1 -fi - -# Find out some information. -SYSTEM=`( test -f /bin/uname && /bin/uname -a ) || \ - ( test -f /usr/bin/uname && /usr/bin/uname -a ) || echo ""` -ARCH=`test -f /bin/arch && /bin/arch` -MACHINE=`test -f /bin/machine && /bin/machine` -FILE_PATHS= - -for cmd in perl make gmake gcc cc -do - file=`which_1 $cmd` - if test $? = 0 - then - if test $cmd = "gcc" - then - GCC_INFO=`$file -v 2>&1` - elif test $cmd = "perl" - then - PERL_INFO=`$file -v | grep -i version 2>&1` - fi - FILE_PATHS="$FILE_PATHS $file" - fi -done - -admin=`which_1 mysqladmin` -MYSQL_SERVER= -if test -x "$admin" -then - MYSQL_SERVER=`$admin version 2> /dev/null` - if test "$?" = "1" - then - MYSQL_SERVER="" - fi -fi - -SUBJECT_C="[50 character or so descriptive subject here (for reference)]" -ORGANIZATION_C='<organization of PR author (multiple lines)>' -LICENCE_C='[none | licence | email support | extended email support ]' -SYNOPSIS_C='<synopsis of the problem (one line)>' -SEVERITY_C='<[ non-critical | serious | critical ] (one line)>' -PRIORITY_C='<[ low | medium | high ] (one line)>' -CLASS_C='<[ sw-bug | doc-bug | change-request | support ] (one line)>' -RELEASE_C='<release number or tag (one line)>' -ENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>' -DESCRIPTION_C='<precise description of the problem (multiple lines)>' -HOW_TO_REPEAT_C='<code/input/activities to reproduce the problem (multiple lines)>' -FIX_C='<how to correct or work around the problem, if known (multiple lines)>' - - -cat > $TEMP <<EOF -SEND-PR: -*- send-pr -*- -SEND-PR: Lines starting with \`SEND-PR' will be removed automatically, as -SEND-PR: will all comments (text enclosed in \`<' and \`>'). -SEND-PR: -From: ${USER} -To: ${BUGADDR} -Subject: $SUBJECT_C - ->Description: - $DESCRIPTION_C ->How-To-Repeat: - $HOW_TO_REPEAT_C ->Fix: - $FIX_C - ->Submitter-Id: <submitter ID> ->Originator: ${ORIGINATOR} ->Organization: -${ORGANIZATION- $ORGANIZATION_C} ->MySQL support: $LICENCE_C ->Synopsis: $SYNOPSIS_C ->Severity: $SEVERITY_C ->Priority: $PRIORITY_C ->Category: mysql ->Class: $CLASS_C ->Release: mysql-${VERSION} ($COMPILATION_COMMENT) -`test -n "$MYSQL_SERVER" && echo ">Server: $MYSQL_SERVER"` ->C compiler: @CC_VERSION@ ->C++ compiler: @CXX_VERSION@ ->Environment: - $ENVIRONMENT_C -`test -n "$SYSTEM" && echo "System: $SYSTEM"` -`test -n "$ARCH" && echo "Architecture: $ARCH"` -`test -n "$MACHINE" && echo "Machine: $MACHINE"` -`test -n "$FILE_PATHS" && echo "Some paths: $FILE_PATHS"` -`test -n "$GCC_INFO" && echo "GCC: $GCC_INFO"` -`test -n "$COMP_CALL_INFO" && echo "Compilation info (call): $COMP_CALL_INFO"` -`test -n "$COMP_RUN_INFO" && echo "Compilation info (used): $COMP_RUN_INFO"` -`test -n "$LIBC_INFO" && echo "LIBC: $LIBC_INFO"` -`test -n "$CONFIGURE_LINE" && echo "Configure command: $CONFIGURE_LINE"` -`test -n "$PERL_INFO" && echo "Perl: $PERL_INFO"` -EOF - -chmod u+w $TEMP -cp $TEMP $TEMP.x - -eval $EDIT $TEMP - -if cmp -s $TEMP $TEMP.x -then - echo "File not changed, no bug report submitted." - mv -f $TEMP /tmp/failed-mysql-bugreport - echo "The raw bug report exists in /tmp/failed-mysql-bugreport" - echo "If you use this remember that the first lines of the report are now a lie.." - exit 1 -fi - -# -# Check the enumeration fields - -# This is a "sed-subroutine" with one keyword parameter -# (with workaround for Sun sed bug) -# -SED_CMD=' -/$PATTERN/{ -s||| -s|<.*>|| -s|^[ ]*|| -s|[ ]*$|| -p -q -}' - - -while :; do - CNT=0 - - # - # 1) Severity - # - PATTERN=">Severity:" - SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` - case "$SEVERITY" in - ""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;; - *) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'." - esac - # - # 2) Priority - # - PATTERN=">Priority:" - PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP` - case "$PRIORITY" in - ""|low|medium|high) CNT=`expr $CNT + 1` ;; - *) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'." - esac - # - # 3) Class - # - PATTERN=">Class:" - CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP` - case "$CLASS" in - ""|sw-bug|doc-bug|change-request|support) CNT=`expr $CNT + 1` ;; - *) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'." - esac - - # - # 4) Synopsis - # - VALUE=`grep "^>Synopsis:" $TEMP | sed 's/>Synopsis:[ ]*//'` - case "$VALUE" in - "$SYNOPSIS_C") echo "$COMMAND: \`$VALUE' is not a valid value for \`Synopsis'." ;; - *) CNT=`expr $CNT + 1` - esac - - test $CNT -lt 4 && - echo "Errors were found with the problem report." - - - # Check if subject of mail was changed, if not, use Synopsis field - # - subject=`grep "^Subject" $TEMP| sed 's/^Subject:[ ]*//'` - if [ X"$subject" = X"$SUBJECT_C" -o X"$subject" = X"$SYNOPSIS_C" ]; then - subject=`grep Synopsis $TEMP | sed 's/>Synopsis:[ ]*//'` - sed "s/^Subject:[ ]*.*/Subject: $subject/" $TEMP > $TEMP.tmp - mv -f $TEMP.tmp $TEMP - fi - - while :; do - $ECHON1 "a)bort, e)dit or s)end? $ECHON2" - read input - case "$input" in - a*) - echo "$COMMAND: problem report saved in $HOME/dead.mysqlbug." - cat $TEMP >> $HOME/dead.mysqlbug - xs=1; exit - ;; - e*) - eval $EDIT $TEMP - continue 2 - ;; - s*) - break 2 - ;; - esac - done -done -# -# Remove comments and send the problem report -# (we have to use patterns, where the comment contains regex chars) -# -# /^>Originator:/s;$ORIGINATOR;; -sed -e " -/^SEND-PR:/d -/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;; -/^>Confidential:/s;<.*>;; -/^>Synopsis:/s;$SYNOPSIS_C;; -/^>Severity:/s;<.*>;; -/^>Priority:/s;<.*>;; -/^>Class:/s;<.*>;; -/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;; -/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;; -/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;; -/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;; -/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;; -" $TEMP > $TEMP.x - -if $MAIL_AGENT < $TEMP.x -then - echo "$COMMAND: problem report sent" - xs=0; exit -else - echo "$COMMAND: mysterious mail failure, report not sent." - echo "$COMMAND: problem report saved in $HOME/dead.mysqlbug." - cat $TEMP >> $HOME/dead.mysqlbug -fi - -exit 0 diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 59f69e79a55..48baf61be3a 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -20,7 +20,6 @@ mysqld_ld_preload= mysqld_ld_library_path= flush_caches=0 numa_interleave=0 -unsafe_my_cnf=0 wsrep_on=0 dry_run=0 @@ -291,13 +290,6 @@ wsrep_recover_position() { return $ret } -check_executable_location() { - if test "$unsafe_my_cnf" = 1 -a "$unrecognized_handling" != collect; then - log_error "Cannot accept $1 from a config file, when my.cnf is in the datadir" - exit 1 - fi -} - parse_arguments() { for arg do val=`echo "$arg" | sed -e "s;--[^=]*=;;"` @@ -328,14 +320,13 @@ parse_arguments() { # mysqld_safe-specific options - must be set in my.cnf ([mysqld_safe])! --core[-_]file[-_]size=*) core_file_size="$val" ;; - --ledir=*) check_executable_location "$arg" ; ledir="$val" ;; - --malloc[-_]lib=*) check_executable_location "$arg"; set_malloc_lib "$val" ;; - --crash[-_]script=*) check_executable_location "$arg"; crash_script="$val" ;; - --mysqld=*) check_executable_location "$arg"; MYSQLD="$val" ;; + --ledir=*) ledir="$val" ;; + --malloc[-_]lib=*) set_malloc_lib "$val" ;; + --crash[-_]script=*) crash_script="$val" ;; + --mysqld=*) MYSQLD="$val" ;; --mysqld[-_]version=*) if test -n "$val" then - check_executable_location "$arg" MYSQLD="mysqld-$val" PLUGIN_VARIANT="/$val" else @@ -566,10 +557,6 @@ print_defaults=`find_in_bin my_print_defaults` if test -d $MY_BASEDIR_VERSION/data/mysql then DATADIR=$MY_BASEDIR_VERSION/data - if test -z "$defaults" -a -r "$DATADIR/my.cnf" - then - defaults="--defaults-extra-file=$DATADIR/my.cnf" - fi # Next try where the source installs put it elif test -d $MY_BASEDIR_VERSION/var/mysql then @@ -581,24 +568,13 @@ fi if test -z "$MYSQL_HOME" then - if test -r "$MY_BASEDIR_VERSION/my.cnf" && test -r "$DATADIR/my.cnf" - then - log_error "WARNING: Found two instances of my.cnf - -$MY_BASEDIR_VERSION/my.cnf and -$DATADIR/my.cnf -IGNORING $DATADIR/my.cnf" - - MYSQL_HOME=$MY_BASEDIR_VERSION - elif test -r "$DATADIR/my.cnf" + if test -r "$DATADIR/my.cnf" then log_error "WARNING: Found $DATADIR/my.cnf -The data directory is a deprecated location for my.cnf, please move it to +The data directory is not a valid location for my.cnf, please move it to $MY_BASEDIR_VERSION/my.cnf" - unsafe_my_cnf=1 - MYSQL_HOME=$DATADIR - else - MYSQL_HOME=$MY_BASEDIR_VERSION fi + MYSQL_HOME=$MY_BASEDIR_VERSION fi export MYSQL_HOME @@ -1106,4 +1082,3 @@ do done log_notice "mysqld from pid file $pid_file ended" - diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index f173a861e85..466bb46b382 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -154,9 +154,8 @@ readonly WSREP_SST_OPT_AUTH # Splitting AUTH into potential user:password pair if ! wsrep_auth_not_set then - readonly AUTH_VEC=(${WSREP_SST_OPT_AUTH//:/ }) - WSREP_SST_OPT_USER="${AUTH_VEC[0]:-}" - WSREP_SST_OPT_PSWD="${AUTH_VEC[1]:-}" + WSREP_SST_OPT_USER="${WSREP_SST_OPT_AUTH%%:*}" + WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_AUTH##*:}" fi readonly WSREP_SST_OPT_USER readonly WSREP_SST_OPT_PSWD diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 10d6896accd..9e3d9560807 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -1,4 +1,4 @@ -#!/bin/bash -ue +#!/bin/sh -ue # Copyright (C) 2010-2014 Codership Oy # @@ -23,7 +23,7 @@ RSYNC_CONF= # rsync configuration file RSYNC_REAL_PID= # rsync process id OS=$(uname) -[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH +[ "$OS" = "Darwin" ] && export -n LD_LIBRARY_PATH # Setting the path for lsof on CentOS export PATH="/usr/sbin:/sbin:$PATH" @@ -60,27 +60,65 @@ check_pid_and_port() { local pid_file=$1 local rsync_pid=$2 - local rsync_port=$3 - - if ! which lsof > /dev/null; then - wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." - exit 2 # ENOENT - fi - - local port_info=$(lsof -i :$rsync_port -Pn 2>/dev/null | \ - grep "(LISTEN)") - local is_rsync=$(echo $port_info | \ - grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null) + local rsync_addr=$3 + local rsync_port=$4 + + case $OS in + FreeBSD) + local port_info="$(sockstat -46lp ${rsync_port} 2>/dev/null | \ + grep ":${rsync_port}")" + local is_rsync="$(echo $port_info | \ + grep -w '[[:space:]]\+rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)" + ;; + *) + if ! which lsof > /dev/null; then + wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." + exit 2 # ENOENT + fi - if [ -n "$port_info" -a -z "$is_rsync" ]; then - wsrep_log_error "rsync daemon port '$rsync_port' has been taken" - exit 16 # EBUSY + local port_info="$(lsof -i :$rsync_port -Pn 2>/dev/null | \ + grep "(LISTEN)")" + local is_rsync="$(echo $port_info | \ + grep -w '^rsync[[:space:]]\+'"$rsync_pid" 2>/dev/null)" + ;; + esac + + local is_listening_all="$(echo $port_info | \ + grep "*:$rsync_port" 2>/dev/null)" + local is_listening_addr="$(echo $port_info | \ + grep "$rsync_addr:$rsync_port" 2>/dev/null)" + + if [ ! -z "$is_listening_all" -o ! -z "$is_listening_addr" ]; then + if [ -z "$is_rsync" ]; then + wsrep_log_error "rsync daemon port '$rsync_port' has been taken" + exit 16 # EBUSY + fi fi check_pid $pid_file && \ [ -n "$port_info" ] && [ -n "$is_rsync" ] && \ [ $(cat $pid_file) -eq $rsync_pid ] } +is_local_ip() +{ + local address="$1" + local get_addr_bin=`which ifconfig` + if [ -z "$get_addr_bin" ] + then + get_addr_bin=`which ip` + get_addr_bin="$get_addr_bin address show" + # Add an slash at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41 + # ip output format is "X.X.X.X/mask" + address="${address}/" + else + # Add an space at the end, so we don't get false positive : 172.18.0.4 matches 172.18.0.41 + # ifconfig output format is "X.X.X.X " + address="$address " + fi + + $get_addr_bin | grep "$address" > /dev/null +} + MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete" rm -rf "$MAGIC_FILE" @@ -117,8 +155,8 @@ fi # --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') # New filter - exclude everything except dirs (schemas) and innodb files -FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' - -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') +FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' + -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*'" if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then @@ -165,7 +203,9 @@ then if ! [ -z $WSREP_SST_OPT_BINLOG ] then # Prepare binlog files - pushd $BINLOG_DIRNAME &> /dev/null + OLD_PWD="$(pwd)" + cd $BINLOG_DIRNAME + binlog_files_full=$(tail -n $BINLOG_N_FILES ${BINLOG_FILENAME}.index) binlog_files="" for ii in $binlog_files_full @@ -177,14 +217,14 @@ then wsrep_log_info "Preparing binlog files for transfer:" tar -cvf $BINLOG_TAR_FILE $binlog_files >&2 fi - popd &> /dev/null + cd "$OLD_PWD" fi # first, the normal directories, so that we can detect incompatible protocol RC=0 - rsync --owner --group --perms --links --specials \ + eval rsync --owner --group --perms --links --specials \ --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ + $WHOLE_FILE_OPT ${FILTER} "$WSREP_SST_OPT_DATA/" \ rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? if [ "$RC" -ne 0 ]; then @@ -216,11 +256,12 @@ then fi # then, we parallelize the transfer of database directories, use . so that pathconcatenation works - pushd "$WSREP_SST_OPT_DATA" >/dev/null + OLD_PWD="$(pwd)" + cd $WSREP_SST_OPT_DATA count=1 - [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) - [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) + [ "$OS" = "Linux" ] && count=$(grep -c processor /proc/cpuinfo) + [ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && count=$(sysctl -n hw.ncpu) find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \ xargs -I{} -0 -P $count \ @@ -229,7 +270,7 @@ then $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ rsync://$WSREP_SST_OPT_ADDR/{} >&2 || RC=$? - popd >/dev/null + cd "$OLD_PWD" if [ $RC -ne 0 ]; then wsrep_log_error "find/rsync returned code $RC:" @@ -271,6 +312,7 @@ then ADDR=$WSREP_SST_OPT_ADDR RSYNC_PORT=$(echo $ADDR | awk -F ':' '{ print $2 }') + RSYNC_ADDR=$(echo $ADDR | awk -F ':' '{ print $1 }') if [ -z "$RSYNC_PORT" ] then RSYNC_PORT=4444 @@ -303,11 +345,19 @@ EOF # rm -rf "$DATA"/ib_logfile* # we don't want old logs around - # listen at all interfaces (for firewalled setups) - rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" & + # If the IP is local listen only in it + if is_local_ip $RSYNC_ADDR + then + rsync --daemon --no-detach --address $RSYNC_ADDR --port $RSYNC_PORT --config "$RSYNC_CONF" & + else + # Not local, possibly a NAT, listen in all interface + rsync --daemon --no-detach --port $RSYNC_PORT --config "$RSYNC_CONF" & + # Overwrite address with all + RSYNC_ADDR="*" + fi RSYNC_REAL_PID=$! - until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_PORT + until check_pid_and_port $RSYNC_PID $RSYNC_REAL_PID $RSYNC_ADDR $RSYNC_PORT do sleep 0.2 done @@ -331,7 +381,9 @@ EOF if ! [ -z $WSREP_SST_OPT_BINLOG ] then - pushd $BINLOG_DIRNAME &> /dev/null + OLD_PWD="$(pwd)" + cd $BINLOG_DIRNAME + if [ -f $BINLOG_TAR_FILE ] then # Clean up old binlog files first @@ -343,7 +395,8 @@ EOF echo ${BINLOG_DIRNAME}/${ii} >> ${BINLOG_FILENAME}.index done fi - popd &> /dev/null + cd "$OLD_PWD" + fi if [ -r "$MAGIC_FILE" ] then |