summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--scripts/mysql_setpermission.sh8
-rw-r--r--scripts/mysql_system_tables_fix.sql5
-rw-r--r--scripts/mysqlhotcopy.sh41
-rw-r--r--scripts/wsrep_sst_common.sh6
-rw-r--r--scripts/wsrep_sst_mariabackup.sh61
-rw-r--r--scripts/wsrep_sst_rsync.sh31
7 files changed, 97 insertions, 57 deletions
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 31557b60..742eb1e1 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -695,7 +695,7 @@ then
then
echo
echo "You can start the MariaDB daemon with:"
- echo "cd '$basedir' ; $bindir/mariadb-safe --datadir='$ldata'"
+ echo "cd '$basedir' ; $bindir/mariadbd-safe --datadir='$ldata'"
echo
echo "You can test the MariaDB daemon with mysql-test-run.pl"
echo "cd '$basedir/@INSTALL_MYSQLTESTDIR@' ; perl mariadb-test-run.pl"
diff --git a/scripts/mysql_setpermission.sh b/scripts/mysql_setpermission.sh
index b3c9c27c..aa165a5e 100644
--- a/scripts/mysql_setpermission.sh
+++ b/scripts/mysql_setpermission.sh
@@ -68,7 +68,7 @@ usage() if ($opt_help); # the help function
if ($opt_host =~ s/:(\d+)$//)
{
- $opt_port = $1;
+ $opt_port = $1;
}
if ($opt_host eq '')
@@ -98,7 +98,7 @@ my $prefix= 'mysql';
if (eval {DBI->install_driver("MariaDB")}) {
$dsn ="DBI:MariaDB:;";
$prefix= 'mariadb';
-}
+}
else {
$dsn = "DBI:mysql:;";
}
@@ -226,11 +226,11 @@ sub setpwd
{
$pass = "PASSWORD(". $dbh->quote($pass) . ")";
}
- my $uh= "$user@$host";
+ my $uh= $user."@".$host;
my $sth = $dbh->prepare("set password for $uh =$pass") || die $dbh->errstr;
$sth->execute || die $dbh->errstr;
$sth->finish;
- print "The password is set for user $user.\n\n";
+ print "The password is set for user $uh.\n\n";
}
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 2b4a678d..64b92fb4 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -230,6 +230,11 @@ UPDATE user
SET plugin='unix_socket' WHERE plugin='auth_socket';
DELETE FROM plugin
WHERE name='auth_socket';
+# Delete plugins that are now inbuilt but might not have been before (MDEV-32043)
+DELETE plugin
+ FROM information_schema.PLUGINS is_p
+ JOIN plugin ON plugin.name = is_p.PLUGIN_NAME
+ WHERE is_p.PLUGIN_LIBRARY IS NULL;
ALTER TABLE user
MODIFY Password char(41) character set latin1 collate latin1_bin NOT NULL default '',
diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh
index 44abcfec..d0821e66 100644
--- a/scripts/mysqlhotcopy.sh
+++ b/scripts/mysqlhotcopy.sh
@@ -189,21 +189,38 @@ $opt{quiet} = 0 if $opt{debug};
$opt{allowold} = 1 if $opt{keepold};
# --- connect to the database ---
+## Socket takes precedence.
my $dsn;
-$dsn = ";host=" . (defined($opt{host}) ? $opt{host} : "localhost");
-$dsn .= ";port=$opt{port}" if $opt{port};
-$dsn .= ";mariadb_socket=$opt{socket}" if $opt{socket};
+my $prefix= 'mysql';
-# use mariadb_read_default_group=mysqlhotcopy so that [client] and
-# [mysqlhotcopy] groups will be read from standard options files.
+if (eval {DBI->install_driver("MariaDB")}) {
+ $dsn ="DBI:MariaDB:;";
+ $prefix= 'mariadb';
+}
+else {
+ $dsn = "DBI:mysql:;";
+}
-my $dbh = DBI->connect("DBI:MariaDB:$dsn;mariadb_read_default_group=mysqlhotcopy",
- $opt{user}, $opt{password},
+if ($opt{socket} and -S $opt{socket})
+{
+ $dsn .= "${prefix}_socket=$opt{socket}";
+}
+else
{
- RaiseError => 1,
- PrintError => 0,
- AutoCommit => 1,
-});
+ $dsn .= "host=" . $opt{host};
+ if ($opt{host} ne "localhost")
+ {
+ $dsn .= ";port=". $opt{port};
+ }
+}
+
+$dsn .= ";mariadb_read_default_group=mysqlhotcopy";
+
+# use mariadb_read_default_group=mysqlhotcopy so that [client] and
+# [mysqlhotcopy] groups will be read from standard options files.
+# make the connection to MariaDB
+my $dbh= DBI->connect($dsn, $opt{user}, $opt{password}, { RaiseError => 1, PrintError => 0}) ||
+ die("Can't make a connection to the MariaDB server.\n The error: $DBI::errstr");
# --- check that checkpoint table exists if specified ---
if ( $opt{checkpoint} ) {
@@ -271,6 +288,8 @@ if ( defined $opt{regexp} ) {
$sth_dbs->execute;
while ( my ($db_name) = $sth_dbs->fetchrow_array ) {
next if $db_name =~ m/^information_schema$/i;
+ next if $db_name =~ m/^performance_schema$/i;
+ next if $db_name =~ m/^sys$/i;
push @db_desc, { 'src' => $db_name, 't_regex' => $t_regex } if ( $db_name =~ m/$opt{regexp}/o );
}
}
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index bf96f79e..2b540581 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -1166,9 +1166,9 @@ is_local_ip()
# the domain name check:
if [ "${2:-0}" -eq 0 ]; then
# We consider all the names of a given host to be local addresses:
- [ "$1" = "$(hostname -s)" -o \
- "$1" = "$(hostname -f)" -o \
- "$1" = "$(hostname -d)" ] && return 0
+ [ "$1" = "$(hostname -s 2>/dev/null)" -o \
+ "$1" = "$(hostname -f 2>/dev/null)" -o \
+ "$1" = "$(hostname -d 2>/dev/null)" ] && return 0
fi
# If the address contains anything other than digits
# and separators, it is not a local address:
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 93f9270e..2b05326e 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -102,9 +102,12 @@ if [ -z "$BACKUP_BIN" ]; then
fi
DATA="$WSREP_SST_OPT_DATA"
+
INFO_FILE='xtrabackup_galera_info'
+DONOR_INFO_FILE='donor_galera_info'
IST_FILE='xtrabackup_ist'
MAGIC_FILE="$DATA/$INFO_FILE"
+DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE"
INNOAPPLYLOG="$DATA/mariabackup.prepare.log"
INNOMOVELOG="$DATA/mariabackup.move.log"
@@ -650,14 +653,14 @@ get_stream()
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
strmcmd="'$STREAM_BIN' -x"
else
- strmcmd="'$STREAM_BIN' -c '$INFO_FILE'"
+ strmcmd="'$STREAM_BIN' -c '$INFO_FILE' '$DONOR_INFO_FILE'"
fi
else
sfmt='tar'
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
strmcmd='tar xfi -'
else
- strmcmd="tar cf - '$INFO_FILE'"
+ strmcmd="tar cf - '$INFO_FILE' '$DONOR_INFO_FILE'"
fi
fi
wsrep_log_info "Streaming with $sfmt"
@@ -679,6 +682,7 @@ cleanup_at_exit()
if [ $estatus -ne 0 ]; then
wsrep_log_error "Removing $MAGIC_FILE file due to signal"
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || :
+ [ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" || :
fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
@@ -915,6 +919,7 @@ monitor_process()
}
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
+[ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE"
read_cnf
setup_ports
@@ -1042,6 +1047,23 @@ setup_commands()
INNOBACKUP="$BACKUP_BIN$WSREP_SST_OPT_CONF --backup$disver${iopts:+ }$iopts$tmpopts$INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA'$mysqld_args $INNOBACKUP"
}
+send_magic()
+{
+ # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
+ # (separated by a space).
+ echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
+ echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$DONOR_MAGIC_FILE"
+ if [ -n "$WSREP_SST_OPT_REMOTE_PSWD" ]; then
+ # Let joiner know that we know its secret
+ echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE"
+ fi
+
+ if [ $WSREP_SST_OPT_BYPASS -eq 0 -a $WSREP_SST_OPT_PROGRESS -eq 1 ]; then
+ # Tell joiner what to expect:
+ echo "$TOTAL_TAG $payload" >> "$MAGIC_FILE"
+ fi
+}
+
get_stream
get_transfer
@@ -1099,20 +1121,7 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
fi
wsrep_log_info "Streaming GTID file before SST"
-
- # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
- # (separated by a space).
- echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
-
- if [ -n "$WSREP_SST_OPT_REMOTE_PSWD" ]; then
- # Let joiner know that we know its secret
- echo "$SECRET_TAG $WSREP_SST_OPT_REMOTE_PSWD" >> "$MAGIC_FILE"
- fi
-
- if [ $WSREP_SST_OPT_PROGRESS -eq 1 ]; then
- # Tell joiner what to expect:
- echo "$TOTAL_TAG $payload" >> "$MAGIC_FILE"
- fi
+ send_magic
ttcmd="$tcmd"
@@ -1202,9 +1211,8 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
wsrep_log_info "Bypassing the SST for IST"
echo "continue" # now server can resume updating data
- # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id
- # (separated by a space).
- echo "$WSREP_SST_OPT_GTID $WSREP_SST_OPT_GTID_DOMAIN_ID" > "$MAGIC_FILE"
+ send_magic
+
echo "1" > "$DATA/$IST_FILE"
if [ -n "$scomp" ]; then
@@ -1310,7 +1318,7 @@ else # joiner
impts="--parallel=$backup_threads${impts:+ }$impts"
fi
- SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
+ SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
@@ -1451,8 +1459,8 @@ else # joiner
TDATA="$DATA"
DATA="$DATA/.sst"
-
MAGIC_FILE="$DATA/$INFO_FILE"
+
wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid
@@ -1590,9 +1598,16 @@ else # joiner
exit 2
fi
+ # use donor magic file, if present
+ # if IST was used, donor magic file was not created
# Remove special tags from the magic file, and from the output:
- coords=$(head -n1 "$MAGIC_FILE")
- wsrep_log_info "Galera co-ords from recovery: $coords"
+ if [ -r "$DONOR_MAGIC_FILE" ]; then
+ coords=$(head -n1 "$DONOR_MAGIC_FILE")
+ wsrep_log_info "Galera co-ords from donor: $coords"
+ else
+ coords=$(head -n1 "$MAGIC_FILE")
+ wsrep_log_info "Galera co-ords from recovery: $coords"
+ fi
echo "$coords" # Output : UUID:seqno wsrep_gtid_domain_id
wsrep_log_info "Total time on joiner: $totime seconds"
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index a8bfc413..aabf5bd3 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -149,10 +149,12 @@ check_pid_and_port()
check_pid "$pid_file" && [ $CHECK_PID -eq $pid ]
}
-STUNNEL_CONF="$WSREP_SST_OPT_DATA/stunnel.conf"
-STUNNEL_PID="$WSREP_SST_OPT_DATA/stunnel.pid"
+DATA="$WSREP_SST_OPT_DATA"
+
+STUNNEL_CONF="$DATA/stunnel.conf"
+STUNNEL_PID="$DATA/stunnel.pid"
-MAGIC_FILE="$WSREP_SST_OPT_DATA/rsync_sst_complete"
+MAGIC_FILE="$DATA/rsync_sst_complete"
get_binlog
@@ -163,7 +165,6 @@ fi
OLD_PWD="$(pwd)"
-DATA="$WSREP_SST_OPT_DATA"
if [ -n "$DATA" -a "$DATA" != '.' ]; then
[ ! -d "$DATA" ] && mkdir -p "$DATA"
cd "$DATA"
@@ -347,7 +348,7 @@ fi
readonly SECRET_TAG='secret'
readonly BYPASS_TAG='bypass'
-SST_PID="$WSREP_SST_OPT_DATA/wsrep_sst.pid"
+SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
@@ -379,8 +380,8 @@ done
MODULE="${WSREP_SST_OPT_MODULE:-rsync_sst}"
-RSYNC_PID="$WSREP_SST_OPT_DATA/$MODULE.pid"
-RSYNC_CONF="$WSREP_SST_OPT_DATA/$MODULE.conf"
+RSYNC_PID="$DATA/$MODULE.pid"
+RSYNC_CONF="$DATA/$MODULE.conf"
# give some time for rsync from the previous SST to complete:
check_round=0
@@ -422,8 +423,8 @@ EOF
if [ $WSREP_SST_OPT_BYPASS -eq 0 ]; then
- FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed"
- ERROR="$WSREP_SST_OPT_DATA/sst_error"
+ FLUSHED="$DATA/tables_flushed"
+ ERROR="$DATA/sst_error"
[ -f "$FLUSHED" ] && rm -f "$FLUSHED"
[ -f "$ERROR" ] && rm -f "$ERROR"
@@ -474,9 +475,9 @@ EOF
# Preparing binlog files for transfer:
wsrep_log_info "Preparing binlog files for transfer:"
tar_type=0
- if tar --help | grep -qw -F -- '--transform'; then
+ if tar --help 2>/dev/null | grep -qw -F -- '--transform'; then
tar_type=1
- elif tar --version | grep -qw -E '^bsdtar'; then
+ elif tar --version 2>/dev/null | grep -qw -E '^bsdtar'; then
tar_type=2
fi
if [ $tar_type -eq 2 ]; then
@@ -580,7 +581,7 @@ FILTER="-f '- /lost+found'
eval rsync ${STUNNEL:+"--rsh='$STUNNEL'"} \
--owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \
- $WHOLE_FILE_OPT $FILTER "'$WSREP_SST_OPT_DATA/'" \
+ $WHOLE_FILE_OPT $FILTER "'$DATA/'" \
"'rsync://$WSREP_SST_OPT_ADDR'" >&2 || RC=$?
if [ $RC -ne 0 ]; then
@@ -688,7 +689,7 @@ FILTER="-f '- /lost+found'
-f '- $ib_log_dir/ib_logfile[0-9]*' \
-f '- $ar_log_dir/aria_log_control' \
-f '- $ar_log_dir/aria_log.*' \
- "$WSREP_SST_OPT_DATA/{}/" \
+ "$DATA/{}/" \
"rsync://$WSREP_SST_OPT_ADDR/{}" >&2 || RC=$?
cd "$OLD_PWD"
@@ -770,7 +771,7 @@ read only = no
timeout = 300
$SILENT
[$MODULE]
- path = $WSREP_SST_OPT_DATA
+ path = $DATA
exclude = .zfs
[$MODULE-log_dir]
path = $ib_log_dir
@@ -979,7 +980,7 @@ EOF
fi
# Extracting binlog files:
wsrep_log_info "Extracting binlog files:"
- if tar --version | grep -qw -E '^bsdtar'; then
+ if tar --version 2>/dev/null | grep -qw -E '^bsdtar'; then
tar -tf "$BINLOG_TAR_FILE" > "$tmpfile" && \
tar -xvf "$BINLOG_TAR_FILE" > /dev/null || RC=$?
else