Commit 0957d257 authored by Jan Lindström's avatar Jan Lindström

MDEV-18830: Port SST fixes from 10.4 to 10.1

modified:   mysql-test/suite/galera/disabled.def
modified:   mysql-test/suite/galera/r/galera_many_rows.result
modified:   mysql-test/suite/galera/t/galera_kill_nochanges.test
new file:   mysql-test/suite/galera/t/galera_many_rows.cnf
modified:   mysql-test/suite/galera/t/galera_many_rows.test
modified:   mysql-test/suite/galera/t/galera_var_dirty_reads.test
modified:   scripts/wsrep_sst_mariabackup.sh
parent 6567636b
......@@ -26,7 +26,24 @@ galera_gcs_fc_limit : MDEV-17061 Timeout in wait_condition.inc for PROCESSLIST
galera_migrate : MariaDB does not support START SLAVE USER
galera_pc_ignore_sb : MDEV-17357 Test failure on galera.galera_pc_ignore_sb
galera_ssl_upgrade : MDEV-13549 Galera test failures
MW-329 : wsrep_local_replays not stable
MW-416 : MDEV-13549 Galera test failures
MW-44 : MDEV-15809 Test failure on galera.MW-44
galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
galera_kill_applier : race condition at the start of the test
galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read transfer status
pxc-421: Lock timeout exceeded
galera_sst_mysqldump_with_key : MDEV-16890 Galera test failure
galera_var_notify_cmd : MDEV-13549 Galera test failures
galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl
galera_var_node_address : MDEV-17151 Galera test failure on galera.galera_var_node_address
galera_as_slave_replication_bundle : MDEV-15785 Test case galera_as_slave_replication_bundle caused debug assertion
galera_wan : MDEV-17259: Test failure on galera.galera_wan
partition : MDEV-13549 regularly showing auto_increment mismatch
galera_pc_ignore_sb : MDEV-17357 Test failure on galera.galera_pc_ignore_sb
MW-328A : MDEV-17847 Galera test failure on MW-328[A|B|C]
MW-328B : MDEV-17847 Galera test failure on MW-328[A|B|C]
MW-328C : MDEV-17847 Galera test failure on MW-328[A|B|C]
query_cache : MDEV-18137: Galera test failure on query_cache
galera_ist_mariabackup : MDEV-18829 Galera test galera_ist_mariabackup leaves port open causing following SST tests to fail
galera.galera_gcache_recover_manytrx : MDEV-18834 Galera test failure on galera_gcache_recover_manytrx
SET SESSION innodb_lock_wait_timeout=600;
SET SESSION lock_wait_timeout=600;
CREATE TABLE ten (f1 INTEGER);
CREATE TABLE ten (f1 INTEGER) engine=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H';
SELECT COUNT(*) = 100000 FROM t1;
COUNT(*) = 100000
1
SELECT COUNT(*) FROM t1;
COUNT(*)
100000
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
SELECT COUNT(*) = 200000 FROM t1;
COUNT(*) = 200000
1
SELECT COUNT(*) FROM t1;
COUNT(*)
200000
UPDATE t1 SET f2 = 1;
SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1;
COUNT(*) = 200000
1
SELECT COUNT(*) FROM t1 WHERE f2 = 1;
COUNT(*)
200000
START TRANSACTION;
SELECT COUNT(*) = 200000 FROM t1;
COUNT(*) = 200000
1
SELECT COUNT(*) FROM t1;
COUNT(*)
200000
UPDATE t1 SET f2 = 3;
START TRANSACTION;
UPDATE t1 SET f2 = 4;
......
......@@ -3,7 +3,11 @@
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
......@@ -29,4 +33,7 @@ SET SESSION wsrep_sync_wait = DEFAULT;
SELECT COUNT(*) = 1 FROM t1;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
DROP TABLE t1;
!include ../galera_2nodes.cnf
[mysqld]
innodb-status-output=ON
innodb-status-output-locks=ON
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
SET SESSION innodb_lock_wait_timeout=600;
SET SESSION lock_wait_timeout=600;
CREATE TABLE ten (f1 INTEGER);
CREATE TABLE ten (f1 INTEGER) engine=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB;
......@@ -20,19 +23,19 @@ SET SESSION wsrep_sync_wait = 15;
SET GLOBAL wsrep_provider_options = 'repl.causal_read_timeout=PT1H';
SELECT COUNT(*) = 100000 FROM t1;
SELECT COUNT(*) FROM t1;
INSERT INTO t1 (f2) SELECT a1.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
--connection node_1
SELECT COUNT(*) = 200000 FROM t1;
SELECT COUNT(*) FROM t1;
UPDATE t1 SET f2 = 1;
--connection node_2
SELECT COUNT(*) = 200000 FROM t1 WHERE f2 = 1;
SELECT COUNT(*) FROM t1 WHERE f2 = 1;
--connection node_1
START TRANSACTION;
SELECT COUNT(*) = 200000 FROM t1;
SELECT COUNT(*) FROM t1;
UPDATE t1 SET f2 = 3;
--connection node_2
......@@ -50,5 +53,7 @@ COMMIT;
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_node2';
--enable_query_log
--source include/auto_increment_offset_restore.inc
DROP TABLE t1;
DROP TABLE ten;
......@@ -11,11 +11,6 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
......
#!/bin/bash -ue
# Copyright (C) 2013 Percona Inc
# Copyright (C) 2017 MariaDB
# Copyright (C) 2017-2019 MariaDB
#
# 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
......@@ -22,6 +22,7 @@
. $(dirname $0)/wsrep_sst_common
OS=$(uname)
ealgo=""
ekey=""
ekeyfile=""
......@@ -76,13 +77,13 @@ sdecomp=""
# 5.6.21 PXC and later can't donate to an older joiner
sst_ver=1
if which pv &>/dev/null && pv --help | grep -q FORMAT;then
if pv --help 2>/dev/null | grep -q FORMAT;then
pvopts+=$pvformat
fi
pcmd="pv $pvopts"
declare -a RC
INNOBACKUPEX_BIN=mariabackup
INNOBACKUPEX_BIN=$(which mariabackup)
XBSTREAM_BIN=mbstream
XBCRYPT_BIN=xbcrypt # Not available in MariaBackup
......@@ -174,10 +175,8 @@ get_transfer()
fi
if [[ $tfmt == 'nc' ]];then
if [[ ! -x `which nc` ]];then
wsrep_log_error "nc(netcat) not found in path: $PATH"
exit 2
fi
wsrep_check_programs nc
wsrep_log_info "Using netcat as streamer"
if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then
if nc -h 2>&1 | grep -q ncat;then
......@@ -204,11 +203,8 @@ get_transfer()
fi
else
tfmt='socat'
wsrep_check_programs socat
wsrep_log_info "Using socat as streamer"
if [[ ! -x `which socat` ]];then
wsrep_log_error "socat not found in path: $PATH"
exit 2
fi
if [[ $encrypt -eq 2 || $encrypt -eq 3 ]] && ! socat -V | grep -q "WITH_OPENSSL 1";then
wsrep_log_error "Encryption requested, but socat is not OpenSSL enabled (encrypt=$encrypt)"
......@@ -297,7 +293,7 @@ get_footprint()
adjust_progress()
{
if [[ ! -x `which pv` ]];then
if ! command -v pv >/dev/null;then
wsrep_log_error "pv not found in path: $PATH"
wsrep_log_error "Disabling all progress/rate-limiting"
pcmd=""
......@@ -336,6 +332,7 @@ read_cnf()
rebuild=$(parse_cnf sst rebuild 0)
ttime=$(parse_cnf sst time 0)
cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
[[ $OS == "FreeBSD" ]] && cpat=$(parse_cnf sst cpat '.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$')
ealgo=$(parse_cnf xtrabackup encrypt "")
ekey=$(parse_cnf xtrabackup encrypt-key "")
ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
......@@ -550,8 +547,12 @@ wait_for_listen()
local MODULE=$3
for i in {1..50}
do
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
sleep 0.2
if [ "$OS" = "FreeBSD" ];then
sockstat -46lp $PORT | grep -qE "^[^ ]* *(socat|nc) *[^ ]* *[^ ]* *[^ ]* *[^ ]*:$PORT" && break
else
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
fi
sleep 0.2
done
echo "ready ${ADDR}/${MODULE}//$sst_ver"
}
......@@ -597,7 +598,7 @@ recv_joiner()
pushd ${dir} 1>/dev/null
set +e
if [[ $tmt -gt 0 && -x `which timeout` ]];then
if [[ $tmt -gt 0 ]] && command -v timeout >/dev/null;then
if timeout --help | grep -q -- '-k';then
ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd"
else
......@@ -662,13 +663,13 @@ monitor_process()
while true ; do
if ! ps --pid "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
if ! ps -p "${WSREP_SST_OPT_PARENT}" &>/dev/null; then
wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly."
kill -- -"${WSREP_SST_OPT_PARENT}"
exit 32
fi
if ! ps --pid "${sst_stream_pid}" &>/dev/null; then
if ! ps -p "${sst_stream_pid}" &>/dev/null; then
break
fi
......@@ -677,10 +678,7 @@ monitor_process()
done
}
if [[ ! -x `which $INNOBACKUPEX_BIN` ]];then
wsrep_log_error "${INNOBACKUPEX_BIN} not in path: $PATH"
exit 2
fi
wsrep_check_programs "$INNOBACKUPEX_BIN"
rm -f "${MAGIC_FILE}"
......@@ -704,9 +702,33 @@ fi
INNOEXTRA=""
INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""}
# Try to set INNODB_DATA_HOME_DIR from the command line:
if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG
fi
# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
fi
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir "")
fi
if [ ! -z "$INNODB_DATA_HOME_DIR" ]; then
INNOEXTRA+=" --innodb-data-home-dir=$INNODB_DATA_HOME_DIR"
fi
if [ -n "$INNODB_DATA_HOME_DIR" ]; then
# handle both relative and absolute paths
INNODB_DATA_HOME_DIR=$(cd $DATA; mkdir -p "$INNODB_DATA_HOME_DIR"; cd $INNODB_DATA_HOME_DIR; pwd -P)
else
# default to datadir
INNODB_DATA_HOME_DIR=$(cd $DATA; pwd -P)
fi
if [[ $ssyslog -eq 1 ]];then
if [[ ! -x `which logger` ]];then
if ! command -v logger >/dev/null;then
wsrep_log_error "logger not in path: $PATH. Ignoring"
else
......@@ -724,7 +746,7 @@ if [[ $ssyslog -eq 1 ]];then
logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
}
INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
fi
......@@ -733,8 +755,8 @@ else
if [[ "$sstlogarchive" -eq 1 ]]
then
ARCHIVETIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S")
newfile=""
ARCHIVETIMESTAMP=$(date "+%Y.%m.%d-%H.%M.%S.%N")
newfile=""
if [[ ! -z "$sstlogarchivedir" ]]
then
......@@ -788,7 +810,7 @@ then
fi
INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts --apply-log \$rebuildcmd \${DATA} &> ${INNOAPPLYLOG}"
INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} &> ${INNOAPPLYLOG}"
INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} &> ${INNOMOVELOG}"
INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> ${INNOBACKUPLOG}"
fi
......@@ -809,7 +831,7 @@ then
exit 93
fi
if [[ -z $(parse_cnf mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then
if [[ -z $(parse_cnf --mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then
xtmpdir=$(mktemp -d)
tmpopts=" --tmpdir=$xtmpdir "
wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory"
......@@ -931,9 +953,9 @@ then
[[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE"
[[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE
ib_home_dir=$(parse_cnf mysqld innodb-data-home-dir "")
ib_log_dir=$(parse_cnf mysqld innodb-log-group-home-dir "")
ib_undo_dir=$(parse_cnf mysqld innodb-undo-directory "")
ib_home_dir=$INNODB_DATA_HOME_DIR
ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "")
ib_undo_dir=$(parse_cnf --mysqld innodb-undo-directory "")
stagemsg="Joiner-Recv"
......@@ -1003,11 +1025,14 @@ then
jpid=$!
wsrep_log_info "Proceeding with SST"
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+
if [ "${OS}" = "FreeBSD" ]; then
find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
else
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
fi
tempdir=$(parse_cnf mysqld log-bin "")
tempdir=$(parse_cnf --mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then
binlog_dir=$(dirname $tempdir)
binlog_file=$(basename $tempdir)
......@@ -1052,7 +1077,7 @@ then
wsrep_log_info "Compressed qpress files found"
if [[ ! -x `which qpress` ]];then
if ! command -v qpress >/dev/null;then
wsrep_log_error "qpress not found in path: $PATH"
exit 22
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment