From 0957d257815871237343f2be4db34786b12dddd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 6 Mar 2019 13:33:37 +0200 Subject: 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 --- mysql-test/suite/galera/disabled.def | 17 ++++ mysql-test/suite/galera/r/galera_many_rows.result | 26 +++--- .../suite/galera/t/galera_kill_nochanges.test | 9 ++- mysql-test/suite/galera/t/galera_many_rows.cnf | 5 ++ mysql-test/suite/galera/t/galera_many_rows.test | 19 +++-- .../suite/galera/t/galera_var_dirty_reads.test | 5 -- scripts/wsrep_sst_mariabackup.sh | 93 ++++++++++++++-------- 7 files changed, 114 insertions(+), 60 deletions(-) create mode 100644 mysql-test/suite/galera/t/galera_many_rows.cnf diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 4b70a84ac2e..baa5afd95a6 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -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 diff --git a/mysql-test/suite/galera/r/galera_many_rows.result b/mysql-test/suite/galera/r/galera_many_rows.result index e650dd6f5de..6f441d9b401 100644 --- a/mysql-test/suite/galera/r/galera_many_rows.result +++ b/mysql-test/suite/galera/r/galera_many_rows.result @@ -1,27 +1,27 @@ 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; diff --git a/mysql-test/suite/galera/t/galera_kill_nochanges.test b/mysql-test/suite/galera/t/galera_kill_nochanges.test index 4106378885f..9360ad542f6 100644 --- a/mysql-test/suite/galera/t/galera_kill_nochanges.test +++ b/mysql-test/suite/galera/t/galera_kill_nochanges.test @@ -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; diff --git a/mysql-test/suite/galera/t/galera_many_rows.cnf b/mysql-test/suite/galera/t/galera_many_rows.cnf new file mode 100644 index 00000000000..4e1022cf67f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_many_rows.cnf @@ -0,0 +1,5 @@ +!include ../galera_2nodes.cnf + +[mysqld] +innodb-status-output=ON +innodb-status-output-locks=ON diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test index 58ba85e1b9e..bc9e99db8da 100644 --- a/mysql-test/suite/galera/t/galera_many_rows.test +++ b/mysql-test/suite/galera/t/galera_many_rows.test @@ -1,13 +1,16 @@ - --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; diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test index 1f01c4aac07..3e2108868af 100644 --- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test +++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test @@ -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` diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index 3fd93a90c1e..b05e99ada36 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -1,6 +1,6 @@ #!/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 -- cgit v1.2.1 From 85a18526bc210e05c8a6feeb053c08f6e8cc867f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 5 Mar 2019 14:01:02 +1100 Subject: wsrep_sst: remove WSREP_SST_OPT_SUFFIX_VALUE, checking [mysqld] is covered in the parse_cnf --mysqld case --- scripts/wsrep_sst_common.sh | 2 -- scripts/wsrep_sst_mariabackup.sh | 5 +---- scripts/wsrep_sst_rsync.sh | 5 +---- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 976f0e0cf2d..da148495b8c 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -28,7 +28,6 @@ WSREP_SST_OPT_PSWD=${WSREP_SST_OPT_PSWD:-} WSREP_SST_OPT_DEFAULT="" WSREP_SST_OPT_EXTRA_DEFAULT="" WSREP_SST_OPT_SUFFIX_DEFAULT="" -WSREP_SST_OPT_SUFFIX_VALUE="" INNODB_DATA_HOME_DIR_ARG="" while [ $# -gt 0 ]; do @@ -94,7 +93,6 @@ case "$1" in ;; '--defaults-group-suffix') readonly WSREP_SST_OPT_SUFFIX_DEFAULT="$1=$2" - readonly WSREP_SST_OPT_SUFFIX_VALUE="$2" shift ;; '--host') diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index b05e99ada36..e8344bbaf8d 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -709,10 +709,7 @@ if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then 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 "") + 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" diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 6b1a7eb6ee6..bc2af40e2a9 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -136,10 +136,7 @@ if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then 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 "") + INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir '') fi if [ -n "$INNODB_DATA_HOME_DIR" ]; then -- cgit v1.2.1 From e8541c7565c2b44460007ec03c01a4f171247c1a Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 5 Mar 2019 15:29:24 +1100 Subject: galera: test cases for non [mysqld] section for configuration --- .../r/galera_ipv6_rsync_section.result | 19 ++++++ .../t/galera_ipv6_mariabackup_section.cnf | 39 +++++++++++++ .../t/galera_ipv6_mariabackup_section.opt | 1 + .../t/galera_ipv6_mariabackup_section.test | 68 ++++++++++++++++++++++ .../galera_3nodes/t/galera_ipv6_rsync_section.cnf | 31 ++++++++++ .../galera_3nodes/t/galera_ipv6_rsync_section.opt | 1 + .../galera_3nodes/t/galera_ipv6_rsync_section.test | 32 ++++++++++ 7 files changed, 191 insertions(+) create mode 100644 mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt create mode 100644 mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result new file mode 100644 index 00000000000..3f810d3eb97 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result @@ -0,0 +1,19 @@ +connection node_2; +connection node_1; +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +connection node_1; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +connection node_2; +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf new file mode 100644 index 00000000000..dc294854056 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf @@ -0,0 +1,39 @@ +!include ../galera_3nodes.cnf + +# decoy value - should not be read by mysqld or sst scripts +[mysqld] +innodb-data-home-dir=/tmp + +[galera] +innodb-data-home-dir= +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" +wsrep_node_address=::1 + +[galera.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.1.port' +wsrep_node_name=node_1 + +[galera.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_node_name=node_2 +wsrep_sst_donor=node_1 + +[galera.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.3.port' +wsrep_node_name=node_3 +wsrep_sst_donor=node_1 + +[SST] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=xbstream +sockopt=",pf=ip6" diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test new file mode 100644 index 00000000000..71d17c133a5 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test @@ -0,0 +1,68 @@ +--source include/galera_cluster.inc +--source include/check_ipv6.inc +--source suite/galera/include/have_mariabackup.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) = 1 FROM t1; + +DROP TABLE t1; + +# Confirm that key messages around SST and IST reference IPv6 + +--connection node_1 +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err +--let $assert_only_after = CURRENT_TEST + +# The SSTs happen when nodes are started first time +--let $assert_count = 2 +--let $assert_text = Streaming the backup to joiner at \[::1\] +--let $assert_select = Streaming the backup to joiner at \[::1\] +--source include/assert_grep.inc + +# There will be 3 ISTs donated from node_1 in Galera 4. +# Two first happen at the initial startup to populate the certification +# index. The third one is from the IST which happens during the actual test. +--let $assert_count = 3 +--let $assert_text = async IST sender starting to serve tcp://\[::1\]: +--let $assert_select = async IST sender starting to serve tcp://\[::1\]: +--source include/assert_grep.inc + +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err + +# There are two ISTs on joiner, the first at the initial startup, the second +# during the actual test. +--let $assert_count = 2 +--let $assert_text = IST receiver addr using tcp://\[::1\] +--let $assert_select = IST receiver addr using tcp://\[::1\] +--source include/assert_grep.inc + +# The receiver expects seqnos 3-6 only once. +--let $assert_count = 1 +--let $assert_text = Prepared IST receiver for 3-6, listening at: tcp://\[::1\] +--let $assert_select = Prepared IST receiver for 3-6, listening at: tcp://\[::1\] +--source include/assert_grep.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf new file mode 100644 index 00000000000..7cac8e1451e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf @@ -0,0 +1,31 @@ +!include ../galera_3nodes.cnf + +# decoy value - should not be read by mysqld or sst scripts +[mysqld] +innodb-data-home-dir=/tmp + +[mariadb] +innodb-data-home-dir= +wsrep_sst_method=rsync +wsrep_node_address=::1 + +[mariadb.1] +wsrep-cluster-address=gcomm:// +wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.1.port' + +[mariadb.2] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.2.port' + +[mariadb.3] +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' +wsrep_node_incoming_address='[::1]:@mysqld.3.port' + +[SST] +sockopt=",pf=ip6" diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt new file mode 100644 index 00000000000..c2bb4d156af --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.opt @@ -0,0 +1 @@ +--bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test new file mode 100644 index 00000000000..1937eb43e13 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.test @@ -0,0 +1,32 @@ +--source include/galera_cluster.inc +--source include/check_ipv6.inc + +# Confirm that initial handshake happened over ipv6 + +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Force IST + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +--connection node_2 +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +SELECT COUNT(*) = 1 FROM t1; + +DROP TABLE t1; -- cgit v1.2.1 From a05ca1a99a821eb8c9e117e681d37327f265fc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 6 Mar 2019 16:41:40 +0200 Subject: Galera 3 versions of the result files recorded. --- .../r/galera_ipv6_mariabackup_section.result | 18 ++++++++++++++++++ .../r/galera_ipv6_rsync_section.result | 5 ----- .../t/galera_ipv6_mariabackup_section.test | 21 +++++++++++---------- 3 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result new file mode 100644 index 00000000000..53e35939a79 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_mariabackup_section.result @@ -0,0 +1,18 @@ +SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; +VARIABLE_VALUE LIKE '%[::1]%' +1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 3 +1 +SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 +DROP TABLE t1; +include/assert_grep.inc [Streaming the backup to joiner at \[::1\]] +include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:] +include/assert_grep.inc [IST receiver addr using tcp://\[::1\]] +include/assert_grep.inc [Prepared IST receiver, listening at: tcp://\[::1\]] diff --git a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result index 3f810d3eb97..a2bf5f4d98c 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result +++ b/mysql-test/suite/galera_3nodes/r/galera_ipv6_rsync_section.result @@ -1,17 +1,12 @@ -connection node_2; -connection node_1; SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses'; VARIABLE_VALUE LIKE '%[::1]%' 1 SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 -connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; -connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); -connection node_2; SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test index 71d17c133a5..95cd1a5bea5 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.test @@ -39,30 +39,31 @@ DROP TABLE t1; --let $assert_only_after = CURRENT_TEST # The SSTs happen when nodes are started first time ---let $assert_count = 2 +--let $assert_count= 2 --let $assert_text = Streaming the backup to joiner at \[::1\] --let $assert_select = Streaming the backup to joiner at \[::1\] --source include/assert_grep.inc -# There will be 3 ISTs donated from node_1 in Galera 4. +# There will be 1 ISTs donated from node_1 in Galera 3. # Two first happen at the initial startup to populate the certification # index. The third one is from the IST which happens during the actual test. ---let $assert_count = 3 +--let $assert_count= 1 --let $assert_text = async IST sender starting to serve tcp://\[::1\]: --let $assert_select = async IST sender starting to serve tcp://\[::1\]: --source include/assert_grep.inc +--connection node_2 --let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.2.err +--let $assert_only_after = CURRENT_TEST -# There are two ISTs on joiner, the first at the initial startup, the second -# during the actual test. ---let $assert_count = 2 +# There is one ISTs on joiner at Galera 3. +--let $assert_count= 1 --let $assert_text = IST receiver addr using tcp://\[::1\] --let $assert_select = IST receiver addr using tcp://\[::1\] --source include/assert_grep.inc -# The receiver expects seqnos 3-6 only once. ---let $assert_count = 1 ---let $assert_text = Prepared IST receiver for 3-6, listening at: tcp://\[::1\] ---let $assert_select = Prepared IST receiver for 3-6, listening at: tcp://\[::1\] +# There will be only one Prepared IST and in Galera 3 segnos are not printed +--let $assert_count= 1 +--let $assert_text = Prepared IST receiver, listening at: tcp://\[::1\] +--let $assert_select = Prepared IST receiver, listening at: tcp://\[::1\] --source include/assert_grep.inc -- cgit v1.2.1 From 9fb84a166ac3f4389d400439d13d2a790c18de1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 7 Mar 2019 08:06:50 +0200 Subject: remove WSREP_SST_OPT_SUFFIX_VALUE, checking [mysqld] is covered in the parse_cnf --mysqld case also in wsrep_sst_xtrabackup-v2 --- scripts/wsrep_sst_xtrabackup-v2.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index 5fad91df18b..54a7c8852e5 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -905,9 +905,6 @@ 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 -- cgit v1.2.1 From b31d025c97cf49ea9d0da26e5948f693e8af60dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 8 Mar 2019 10:13:14 +0200 Subject: Decrease the time required to run test by removing unnecessary sleeps. modified: suite/galera/t/galera_autoinc_sst_mariabackup.test --- mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test index 731059dc584..20f2fb9dea0 100644 --- a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test @@ -5,7 +5,6 @@ --source include/big_test.inc --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_mariabackup.inc --connection node_1 @@ -29,11 +28,11 @@ END| DELIMITER ;| --send CALL p1(); ---sleep 2 +--sleep 1 --connection node_2 --send CALL p1(); ---sleep 2 +--sleep 1 # Kill and restart node #2 @@ -41,10 +40,7 @@ DELIMITER ;| --connection node_2a --source include/kill_galera.inc ---sleep 10 --source include/start_mysqld.inc ---sleep 25 ---source include/wait_until_connected_again.inc INSERT INTO t1 VALUES (DEFAULT); @@ -68,8 +64,6 @@ INSERT INTO t1 VALUES (DEFAULT); --error 2013,2006 --reap ---sleep 10 - # Confirm that the count is correct and that the cluster is intact --connection node_1a -- cgit v1.2.1 From 04150218408741aa4599d90aefadb4cb6f15029c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Mar 2019 08:49:06 +0200 Subject: Clean up mysql-test/suite/galera/disabled.def again Clean up after commit 0957d257815871237343f2be4db34786b12dddd5 which introduced some disorder (unsorted or duplicated test names). --- mysql-test/suite/galera/disabled.def | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index baa5afd95a6..2c0ef3f8e20 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -11,9 +11,13 @@ ############################################################################## GAL-419 : MDEV-13549 Galera test failures +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] MW-329 : wsrep_local_replays not stable MW-336 : MDEV-13549 Timeout in wait_condition.inc for PROCESSLIST MW-416 : MDEV-13549 Galera test failures +MW-44 : MDEV-15809 Test failure on galera.MW-44 galera_account_management : MariaDB 10.0 does not support ALTER USER galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID @@ -22,28 +26,19 @@ galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_binlog_stmt_autoinc : MDEV-13549 auto_increment mismatch galera_flush : MariaDB does not have global.thread_statistics +galera_gcache_recover_manytrx : MDEV-18834 Galera test failure galera_gcs_fc_limit : MDEV-17061 Timeout in wait_condition.inc for PROCESSLIST +galera_ist_mariabackup : MDEV-18829 test leaves port open +galera_ist_progress: MDEV-15236 fails when trying to read transfer status +galera_kill_applier : race condition at the start of the test +galera_kill_ddl : MDEV-17108 Test failure on galera.galera_kill_ddl 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_node_address : MDEV-17151 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] +pxc-421: Lock timeout exceeded 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 -- cgit v1.2.1 From 2a2ab121b0f65cdc4b104ec763d23f1b7035a644 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 29 Jan 2019 14:45:51 +0300 Subject: MDEV-17703 Add WITH_UBSAN switch to CMake similar to WITH_ASAN This can be useful: UBSAN_OPTIONS=log_path=/some/path clang users may want to increase stack size in include/my_pthread.h or enable some optimizations --- CMakeLists.txt | 9 +++++++++ cmake/os/Linux.cmake | 2 +- cmake/plugin.cmake | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 358f73ccfdd..3bfbcc4995d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -214,6 +214,15 @@ IF (WITH_ASAN) ENDIF() ENDIF() +OPTION(WITH_UBSAN "Enable undefined behavior sanitizer" OFF) +IF (WITH_UBSAN) + IF(SECURITY_HARDENED) + MESSAGE(FATAL_ERROR "WITH_UBSAN and SECURITY_HARDENED are mutually exclusive") + ENDIF() + MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined" DEBUG RELWITHDEBINFO) +ENDIF() + + # enable security hardening features, like most distributions do # in our benchmarks that costs about ~1% of performance, depending on the load IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "4.6") diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index b0680d92a1b..55be8674802 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -35,7 +35,7 @@ ENDFOREACH() # Ensure we have clean build for shared libraries # without unresolved symbols # Not supported with AddressSanitizer -IF(NOT WITH_ASAN) +IF(NOT WITH_ASAN AND NOT WITH_UBSAN) SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") ENDIF() diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index cfd9677333e..e38439f2a21 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -209,7 +209,7 @@ MACRO(MYSQL_ADD_PLUGIN) ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") TARGET_LINK_LIBRARIES (${target} mysqld) ENDIF() - ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT WITH_ASAN) + ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT WITH_ASAN AND NOT WITH_UBSAN) TARGET_LINK_LIBRARIES (${target} "-Wl,--no-undefined") ENDIF() -- cgit v1.2.1 From 1ab049e5722975f64d3b8906dd73768898192c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Mar 2019 17:17:24 +0200 Subject: MDEV-18878 Purge: Optimize away futile table lookups If a table has been dropped, rebuilt, or its tablespace has been discarded or the table is corrupted, it does not make sense to look up that table again while purging old undo log records. purge_node_t::purge_node_t(): Replaces row_purge_node_create(). que_common_t::que_common_t(): Constructor. row_import_update_index_root(): Remove the constant parameter dict_locked=true, and update the table->def_trx_id in the cache. purge_node_t::unavailable_table_id: The latest unavailable table ID, to avoid future lookups. purge_node_t::def_trx_id: The latest modification of the table identified by unavailable_table_id, or TRX_ID_MAX. purge_node_t::is_skipped(): Determine if a table should be skipped. purge_node_t::skip(): Note that a table should be skipped. --- storage/innobase/include/que0que.h | 35 +-------------------- storage/innobase/include/que0types.h | 39 ++++++++++++++++++++++++ storage/innobase/include/row0import.h | 21 ++++--------- storage/innobase/include/row0purge.h | 43 +++++++++++++++++++------- storage/innobase/row/row0import.cc | 32 +++++--------------- storage/innobase/row/row0mysql.cc | 2 +- storage/innobase/row/row0purge.cc | 57 ++++++++++++++--------------------- storage/innobase/trx/trx0purge.cc | 5 +-- 8 files changed, 112 insertions(+), 122 deletions(-) diff --git a/storage/innobase/include/que0que.h b/storage/innobase/include/que0que.h index cf8e48be0af..e1a9606805a 100644 --- a/storage/innobase/include/que0que.h +++ b/storage/innobase/include/que0que.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. 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 @@ -460,39 +460,6 @@ struct que_fork_t{ /* Flag which is ORed to control structure statement node types */ #define QUE_NODE_CONTROL_STAT 1024 -/* Query graph node types */ -#define QUE_NODE_LOCK 1 -#define QUE_NODE_INSERT 2 -#define QUE_NODE_UPDATE 4 -#define QUE_NODE_CURSOR 5 -#define QUE_NODE_SELECT 6 -#define QUE_NODE_AGGREGATE 7 -#define QUE_NODE_FORK 8 -#define QUE_NODE_THR 9 -#define QUE_NODE_UNDO 10 -#define QUE_NODE_COMMIT 11 -#define QUE_NODE_ROLLBACK 12 -#define QUE_NODE_PURGE 13 -#define QUE_NODE_CREATE_TABLE 14 -#define QUE_NODE_CREATE_INDEX 15 -#define QUE_NODE_SYMBOL 16 -#define QUE_NODE_RES_WORD 17 -#define QUE_NODE_FUNC 18 -#define QUE_NODE_ORDER 19 -#define QUE_NODE_PROC (20 + QUE_NODE_CONTROL_STAT) -#define QUE_NODE_IF (21 + QUE_NODE_CONTROL_STAT) -#define QUE_NODE_WHILE (22 + QUE_NODE_CONTROL_STAT) -#define QUE_NODE_ASSIGNMENT 23 -#define QUE_NODE_FETCH 24 -#define QUE_NODE_OPEN 25 -#define QUE_NODE_COL_ASSIGNMENT 26 -#define QUE_NODE_FOR (27 + QUE_NODE_CONTROL_STAT) -#define QUE_NODE_RETURN 28 -#define QUE_NODE_ROW_PRINTF 29 -#define QUE_NODE_ELSIF 30 -#define QUE_NODE_CALL 31 -#define QUE_NODE_EXIT 32 - #include "que0que.ic" #endif diff --git a/storage/innobase/include/que0types.h b/storage/innobase/include/que0types.h index 017e5df9a6f..2b5a04811b3 100644 --- a/storage/innobase/include/que0types.h +++ b/storage/innobase/include/que0types.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2009, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. 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 @@ -36,6 +37,39 @@ typedef struct que_fork_t que_t; struct que_thr_t; +/* Query graph node types */ +#define QUE_NODE_LOCK 1 +#define QUE_NODE_INSERT 2 +#define QUE_NODE_UPDATE 4 +#define QUE_NODE_CURSOR 5 +#define QUE_NODE_SELECT 6 +#define QUE_NODE_AGGREGATE 7 +#define QUE_NODE_FORK 8 +#define QUE_NODE_THR 9 +#define QUE_NODE_UNDO 10 +#define QUE_NODE_COMMIT 11 +#define QUE_NODE_ROLLBACK 12 +#define QUE_NODE_PURGE 13 +#define QUE_NODE_CREATE_TABLE 14 +#define QUE_NODE_CREATE_INDEX 15 +#define QUE_NODE_SYMBOL 16 +#define QUE_NODE_RES_WORD 17 +#define QUE_NODE_FUNC 18 +#define QUE_NODE_ORDER 19 +#define QUE_NODE_PROC (20 + QUE_NODE_CONTROL_STAT) +#define QUE_NODE_IF (21 + QUE_NODE_CONTROL_STAT) +#define QUE_NODE_WHILE (22 + QUE_NODE_CONTROL_STAT) +#define QUE_NODE_ASSIGNMENT 23 +#define QUE_NODE_FETCH 24 +#define QUE_NODE_OPEN 25 +#define QUE_NODE_COL_ASSIGNMENT 26 +#define QUE_NODE_FOR (27 + QUE_NODE_CONTROL_STAT) +#define QUE_NODE_RETURN 28 +#define QUE_NODE_ROW_PRINTF 29 +#define QUE_NODE_ELSIF 30 +#define QUE_NODE_CALL 31 +#define QUE_NODE_EXIT 32 + /* Common struct at the beginning of each query graph node; the name of this substruct must be 'common' */ @@ -51,6 +85,11 @@ struct que_common_t{ symbol node or a function node, then we have to free the data field in val explicitly */ + + /** Constructor */ + que_common_t(ulint type, que_node_t* parent) + : type(type), parent(parent), brother(), val(), val_buf_size() + {} }; #endif diff --git a/storage/innobase/include/row0import.h b/storage/innobase/include/row0import.h index 12fe6b4f5d2..99752f7f7d3 100644 --- a/storage/innobase/include/row0import.h +++ b/storage/innobase/include/row0import.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. 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 @@ -63,22 +63,13 @@ row_import_update_discarded_flag( dict_sys_t:: mutex. */ MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*****************************************************************//** -Update the (space, root page) of a table's indexes from the values -in the data dictionary. +/** Update the root page numbers and tablespace ID of a table. +@param[in,out] trx dictionary transaction +@param[in,out] table persistent table +@param[in] reset whether to reset the fields to FIL_NULL @return DB_SUCCESS or error code */ dberr_t -row_import_update_index_root( -/*=========================*/ - trx_t* trx, /*!< in/out: transaction that - covers the update */ - const dict_table_t* table, /*!< in: Table for which we want - to set the root page_no */ - bool reset, /*!< in: if true then set to - FIL_NUL */ - bool dict_locked) /*!< in: Set to true if the - caller already owns the - dict_sys_t:: mutex. */ +row_import_update_index_root(trx_t* trx, dict_table_t* table, bool reset) MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* row0import_h */ diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h index ceb4a34cd72..a2a23975e4c 100644 --- a/storage/innobase/include/row0purge.h +++ b/storage/innobase/include/row0purge.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. 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 @@ -35,16 +35,6 @@ Created 3/14/1997 Heikki Tuuri #include "ut0vec.h" #include "row0mysql.h" -/** Create a purge node to a query graph. -@param[in] parent parent node, i.e., a thr node -@param[in] heap memory heap where created -@return own: purge node */ -purge_node_t* -row_purge_node_create( - que_thr_t* parent, - mem_heap_t* heap) - MY_ATTRIBUTE((warn_unused_result)); - /** Determines if it is possible to remove a secondary index entry. Removal is possible if the secondary index entry does not refer to any not delete marked version of a clustered index record where DB_TRX_ID @@ -102,6 +92,13 @@ struct purge_node_t{ ulint rec_type;/*!< undo log record type: TRX_UNDO_INSERT_REC, ... */ +private: + /** latest unavailable table ID (do not bother looking up again) */ + table_id_t unavailable_table_id; + /** the latest modification of the table definition identified by + unavailable_table_id, or TRX_ID_MAX */ + trx_id_t def_trx_id; +public: dict_table_t* table; /*!< table where purge is done */ ulint cmpl_info;/* compiler analysis info of an update */ @@ -131,6 +128,12 @@ struct purge_node_t{ It resets after processing each undo log record. */ purge_vcol_info_t vcol_info; + /** Constructor */ + explicit purge_node_t(que_thr_t* parent) : + common(QUE_NODE_PURGE, parent), heap(mem_heap_create(256)), + done(TRUE) + {} + #ifdef UNIV_DEBUG /***********************************************************//** Validate the persisent cursor. The purge node has two references @@ -146,6 +149,24 @@ struct purge_node_t{ computation. @return true if the table failed to open. */ bool vcol_op_failed() const { return !vcol_info.validate(); } + + /** Determine if a table should be skipped in purge. + @param[in] table_id table identifier + @return whether to skip the table lookup and processing */ + bool is_skipped(table_id_t id) const + { + return id == unavailable_table_id && trx_id <= def_trx_id; + } + + /** Remember that a table should be skipped in purge. + @param[in] id table identifier + @param[in] limit last transaction for which to skip */ + void skip(table_id_t id, trx_id_t limit) + { + DBUG_ASSERT(limit >= trx_id || !srv_safe_truncate); + unavailable_table_id = id; + def_trx_id = limit; + } }; #endif diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index c1ac0b000e3..b9c18ca6a4e 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2018, MariaDB Corporation. +Copyright (c) 2015, 2019, MariaDB Corporation. 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 @@ -3064,23 +3064,13 @@ row_import_read_cfg( return(err); } -/*****************************************************************//** -Update the of a table's indexes from the values -in the data dictionary. +/** Update the root page numbers and tablespace ID of a table. +@param[in,out] trx dictionary transaction +@param[in,out] table persistent table +@param[in] reset whether to reset the fields to FIL_NULL @return DB_SUCCESS or error code */ dberr_t -row_import_update_index_root( -/*=========================*/ - trx_t* trx, /*!< in/out: transaction that - covers the update */ - const dict_table_t* table, /*!< in: Table for which we want - to set the root page_no */ - bool reset, /*!< in: if true then set to - FIL_NUL */ - bool dict_locked) /*!< in: Set to true if the - caller already owns the - dict_sys_t:: mutex. */ - +row_import_update_index_root(trx_t* trx, dict_table_t* table, bool reset) { const dict_index_t* index; que_t* graph = 0; @@ -3096,9 +3086,7 @@ row_import_update_index_root( "WHERE TABLE_ID = :table_id AND ID = :index_id;\n" "END;\n"}; - if (!dict_locked) { - mutex_enter(&dict_sys->mutex); - } + table->def_trx_id = trx->id; for (index = dict_table_get_first_index(table); index != 0; @@ -3173,10 +3161,6 @@ row_import_update_index_root( que_graph_free(graph); - if (!dict_locked) { - mutex_exit(&dict_sys->mutex); - } - return(err); } @@ -4118,7 +4102,7 @@ row_import_for_mysql( row_mysql_lock_data_dictionary(trx); /* Update the root pages of the table's indexes. */ - err = row_import_update_index_root(trx, table, false, true); + err = row_import_update_index_root(trx, table, false); if (err != DB_SUCCESS) { return(row_import_error(prebuilt, trx, err)); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 5fbc0cd3419..cf40eb071e8 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2940,7 +2940,7 @@ row_discard_tablespace( } /* Update the index root pages in the system tables, on disk */ - err = row_import_update_index_root(trx, table, true, true); + err = row_import_update_index_root(trx, table, true); if (err != DB_SUCCESS) { return(err); diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index b439b593e33..06e6c81b971 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. 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 @@ -57,31 +57,6 @@ check. If you make a change in this module make sure that no codepath is introduced where a call to log_free_check() is bypassed. */ -/** Create a purge node to a query graph. -@param[in] parent parent node, i.e., a thr node -@param[in] heap memory heap where created -@return own: purge node */ -purge_node_t* -row_purge_node_create( - que_thr_t* parent, - mem_heap_t* heap) -{ - purge_node_t* node; - - ut_ad(parent != NULL); - ut_ad(heap != NULL); - - node = static_cast( - mem_heap_zalloc(heap, sizeof(*node))); - - node->common.type = QUE_NODE_PURGE; - node->common.parent = parent; - node->done = TRUE; - node->heap = mem_heap_create(256); - - return(node); -} - /***********************************************************//** Repositions the pcur in the purge node on the clustered index record, if found. If the record is not found, close pcur. @@ -966,7 +941,6 @@ row_purge_parse_undo_rec( byte* ptr; undo_no_t undo_no; table_id_t table_id; - trx_id_t trx_id; roll_ptr_t roll_ptr; ulint info_bits; ulint type; @@ -980,15 +954,14 @@ row_purge_parse_undo_rec( node->rec_type = type; - if (type == TRX_UNDO_UPD_DEL_REC && !*updated_extern) { - - return(false); + if ((type == TRX_UNDO_UPD_DEL_REC && !*updated_extern) + || node->is_skipped(table_id)) { + node->table = NULL; + return false; } - ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr, + ptr = trx_undo_update_rec_get_sys_cols(ptr, &node->trx_id, &roll_ptr, &info_bits); - node->table = NULL; - node->trx_id = trx_id; /* Prevent DROP TABLE etc. from running when we are doing the purge for this row */ @@ -999,15 +972,18 @@ try_again: node->table = dict_table_open_on_id( table_id, FALSE, DICT_TABLE_OP_NORMAL); + trx_id_t trx_id; + if (node->table == NULL) { /* The table has been dropped: no need to do purge */ + trx_id = TRX_ID_MAX; goto err_exit; } ut_ad(!dict_table_is_temporary(node->table)); if (!fil_table_accessible(node->table)) { - goto close_exit; + goto inaccessible; } if (node->table->n_v_cols && !node->table->vc_templ @@ -1036,11 +1012,20 @@ try_again: /* The table was corrupt in the data dictionary. dict_set_corrupted() works on an index, and we do not have an index to call it with. */ +inaccessible: + DBUG_ASSERT(table_id == node->table->id); + trx_id = node->table->def_trx_id; + if (!trx_id) { + trx_id = TRX_ID_MAX; + } close_exit: dict_table_close(node->table, FALSE, FALSE); node->table = NULL; err_exit: rw_lock_s_unlock(dict_operation_lock); + if (table_id) { + node->skip(table_id, trx_id); + } return(false); } @@ -1049,13 +1034,15 @@ err_exit: && !*updated_extern) { /* Purge requires no changes to indexes: we may return */ + table_id = 0; goto close_exit; } ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref), node->heap); - ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, + ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, + node->trx_id, roll_ptr, info_bits, node->heap, &(node->update)); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index c4f272acf07..8f28945b62b 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. 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 @@ -182,7 +182,8 @@ purge_graph_build() for (ulint i = 0; i < srv_n_purge_threads; ++i) { que_thr_t* thr = que_thr_create(fork, heap, NULL); - thr->child = row_purge_node_create(thr, heap); + thr->child = new(mem_heap_zalloc(heap, sizeof(purge_node_t))) + purge_node_t(thr); } return(fork); -- cgit v1.2.1 From 6e76704613bf5a143a148fc07fdde7a07eb97634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Mar 2019 17:18:37 +0200 Subject: MDEV-18878: Slimmer purge in non-debug builds purge_node_t::in_progress: Replaces purge_node_t::done. Only present in debug builds. purge_node_t::start(): Moved from the start of row_purge_step(). purge_node_t::end(): Replaces row_purge_end(). trx_purge_attach_undo_recs(): Omit a check from non-debug builds. --- storage/innobase/include/row0purge.h | 38 ++++++++++++++++++++++++++++++++---- storage/innobase/row/row0purge.cc | 29 ++------------------------- storage/innobase/trx/trx0purge.cc | 16 ++++++++------- 3 files changed, 45 insertions(+), 38 deletions(-) diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h index a2a23975e4c..83babd18390 100644 --- a/storage/innobase/include/row0purge.h +++ b/storage/innobase/include/row0purge.h @@ -115,13 +115,16 @@ public: mem_heap_t* heap; /*!< memory heap used as auxiliary storage for row; this must be emptied after a successful purge of a row */ - ibool found_clust;/* TRUE if the clustered index record + ibool found_clust;/*!< whether the clustered index record determined by ref was found in the clustered index, and we were able to position pcur on it */ btr_pcur_t pcur; /*!< persistent cursor used in searching the clustered index record */ - ibool done; /* Debug flag */ +#ifdef UNIV_DEBUG + /** whether the operation is in progress */ + bool in_progress; +#endif trx_id_t trx_id; /*!< trx id for this purging record */ /** Virtual column information about opening of MariaDB table. @@ -130,8 +133,7 @@ public: /** Constructor */ explicit purge_node_t(que_thr_t* parent) : - common(QUE_NODE_PURGE, parent), heap(mem_heap_create(256)), - done(TRUE) + common(QUE_NODE_PURGE, parent), heap(mem_heap_create(256)) {} #ifdef UNIV_DEBUG @@ -167,6 +169,34 @@ public: unavailable_table_id = id; def_trx_id = limit; } + + /** Start processing an undo log record. */ + void start() + { + ut_ad(in_progress); + DBUG_ASSERT(common.type == QUE_NODE_PURGE); + + table = NULL; + row = NULL; + ref = NULL; + index = NULL; + update = NULL; + found_clust = FALSE; + rec_type = ULINT_UNDEFINED; + cmpl_info = ULINT_UNDEFINED; + } + + /** Reset the state at end + @return the query graph parent */ + que_node_t* end() + { + DBUG_ASSERT(common.type == QUE_NODE_PURGE); + undo_recs = NULL; + ut_d(in_progress = false); + vcol_info.reset(); + mem_heap_empty(heap); + return common.parent; + } }; #endif diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 06e6c81b971..2069e94127d 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1176,25 +1176,11 @@ row_purge_end( /*==========*/ que_thr_t* thr) /*!< in: query thread */ { - purge_node_t* node; - ut_ad(thr); - node = static_cast(thr->run_node); - - ut_ad(que_node_get_type(node) == QUE_NODE_PURGE); - - thr->run_node = que_node_get_parent(node); - - node->undo_recs = NULL; - - node->done = TRUE; - - node->vcol_info.reset(); + thr->run_node = static_cast(thr->run_node)->end(); ut_a(thr->run_node != NULL); - - mem_heap_empty(node->heap); } /***********************************************************//** @@ -1212,18 +1198,7 @@ row_purge_step( node = static_cast(thr->run_node); - node->table = NULL; - node->row = NULL; - node->ref = NULL; - node->index = NULL; - node->update = NULL; - node->found_clust = FALSE; - node->rec_type = ULINT_UNDEFINED; - node->cmpl_info = ULINT_UNDEFINED; - - ut_a(!node->done); - - ut_ad(que_node_get_type(node) == QUE_NODE_PURGE); + node->start(); if (!(node->undo_recs == NULL || ib_vector_is_empty(node->undo_recs))) { trx_purge_rec_t*purge_rec; diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 8f28945b62b..18ebbc4aeee 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1501,7 +1501,7 @@ trx_purge_attach_undo_recs( ulint batch_size) /*!< in: no. of pages to purge */ { que_thr_t* thr; - ulint i = 0; + ulint i; ulint n_pages_handled = 0; ulint n_thrs = UT_LIST_GET_LEN(purge_sys->query->thrs); @@ -1509,6 +1509,8 @@ trx_purge_attach_undo_recs( purge_sys->limit = purge_sys->iter; +#ifdef UNIV_DEBUG + i = 0; /* Debug code to validate some pre-requisites and reset done flag. */ for (thr = UT_LIST_GET_FIRST(purge_sys->query->thrs); thr != NULL && i < n_purge_threads; @@ -1519,16 +1521,16 @@ trx_purge_attach_undo_recs( /* Get the purge node. */ node = (purge_node_t*) thr->child; - ut_a(que_node_get_type(node) == QUE_NODE_PURGE); - ut_a(node->undo_recs == NULL); - ut_a(node->done); - - node->done = FALSE; + ut_ad(que_node_get_type(node) == QUE_NODE_PURGE); + ut_ad(node->undo_recs == NULL); + ut_ad(!node->in_progress); + ut_d(node->in_progress = true); } /* There should never be fewer nodes than threads, the inverse however is allowed because we only use purge threads as needed. */ - ut_a(i == n_purge_threads); + ut_ad(i == n_purge_threads); +#endif /* Fetch and parse the UNDO records. The UNDO records are added to a per purge node vector. */ -- cgit v1.2.1 From 219752805cd012af41a74ae95a5732a67adecd4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Mar 2019 17:24:24 +0200 Subject: Try to address MDEV-17745 wait_all_purged.inc: Wait for 60 seconds instead of 30 seconds. Purge can be slow on buildbot, especially in ASAN-instrumented builds. --- mysql-test/suite/innodb/include/wait_all_purged.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/include/wait_all_purged.inc b/mysql-test/suite/innodb/include/wait_all_purged.inc index c7a16888829..992e14f0843 100644 --- a/mysql-test/suite/innodb/include/wait_all_purged.inc +++ b/mysql-test/suite/innodb/include/wait_all_purged.inc @@ -7,7 +7,7 @@ if (!$wait_all_purged) } let $remaining_expect= `select concat('InnoDB ',$wait_all_purged)`; -let $wait_counter= 300; +let $wait_counter= 600; while ($wait_counter) { --replace_regex /.*History list length ([0-9]+).*/\1/ -- cgit v1.2.1 From 28e713dc12881e7f50207d0c642523ca3e630114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 Mar 2019 17:29:46 +0200 Subject: MDEV-18878: Correct a condition Initialize node->trx_id before checking if a table can be skipped. --- storage/innobase/row/row0purge.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 2069e94127d..076f6b16087 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -954,8 +954,8 @@ row_purge_parse_undo_rec( node->rec_type = type; - if ((type == TRX_UNDO_UPD_DEL_REC && !*updated_extern) - || node->is_skipped(table_id)) { + if (type == TRX_UNDO_UPD_DEL_REC && !*updated_extern) { +skip: node->table = NULL; return false; } @@ -963,6 +963,10 @@ row_purge_parse_undo_rec( ptr = trx_undo_update_rec_get_sys_cols(ptr, &node->trx_id, &roll_ptr, &info_bits); + if (node->is_skipped(table_id)) { + goto skip; + } + /* Prevent DROP TABLE etc. from running when we are doing the purge for this row */ -- cgit v1.2.1