Commit 139d65ab authored by Julius Goryavsky's avatar Julius Goryavsky

Merge remote-tracking branch 'origin/bb-10.5-MDEV-30822-galera' into bb-10.6-MDEV-30822-galera

parents a74bea7b b345e366
...@@ -5,7 +5,11 @@ DROP TABLE t1; ...@@ -5,7 +5,11 @@ DROP TABLE t1;
ERROR 42S02: Unknown table 'test.t1' ERROR 42S02: Unknown table 'test.t1'
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
GRA_.log connection node_2;
SELECT * FROM t1;
f1
1
connection node_1;
GRA_.log GRA_.log
DROP TABLE t1; DROP TABLE t1;
CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query"); CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query");
......
...@@ -13,6 +13,11 @@ DROP TABLE t1; ...@@ -13,6 +13,11 @@ DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
--connection node_2
SELECT * FROM t1;
--connection node_1
# Expect only one GRA_*.log file # Expect only one GRA_*.log file
# TODO replace_regex is somehow broken, it will filter out # TODO replace_regex is somehow broken, it will filter out
# result totally if replacement string is already in result # result totally if replacement string is already in result
...@@ -20,7 +25,6 @@ INSERT INTO t1 VALUES (1); ...@@ -20,7 +25,6 @@ INSERT INTO t1 VALUES (1);
# to get GRA_.log two times, this works for some reason # to get GRA_.log two times, this works for some reason
# #
--replace_regex /GRA_.+\.log/GRA_.log/ --replace_regex /GRA_.+\.log/GRA_.log/
--list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log
--replace_regex /GRA_.+\.log/GRA_.log/ --replace_regex /GRA_.+\.log/GRA_.log/
--list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log --list_files $MYSQLTEST_VARDIR/mysqld.2/data GRA_*.log
......
connection node_2; connection node_2;
connection node_1; connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1; connection node_1;
connection node_2; connection node_2;
connection node_3; connection node_3;
connection node_2; connection node_2;
SET wsrep_on=OFF; SET SESSION wsrep_on=OFF;
DROP SCHEMA test; DROP SCHEMA test;
connection node_3; connection node_3;
SET wsrep_on=OFF; SET SESSION wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb;
connection node_1; connection node_1;
CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; INSERT INTO test.t1 values (1);
VARIABLE_VALUE
1
SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value Variable_name Value
wsrep_cluster_status Primary wsrep_cluster_status Primary
......
...@@ -45,6 +45,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this ...@@ -45,6 +45,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this
CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\.");
CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("Failed to initialize plugins\\.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)");
connection node_3; connection node_3;
...@@ -58,6 +59,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this ...@@ -58,6 +59,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this
CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\.");
CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("Failed to initialize plugins\\.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)");
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/force_restart.inc --source include/force_restart.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --let $galera_connection_name = node_3
--let $galera_server_number = 3
--source include/galera_connect.inc
# Save original auto_increment_offset values. # Save original auto_increment_offset values.
--let $node_1=node_1 --let $node_1=node_1
...@@ -14,11 +16,11 @@ ...@@ -14,11 +16,11 @@
# 1. Create different inconsistencies on nodes 2 and 3 # 1. Create different inconsistencies on nodes 2 and 3
# #
--connection node_2 --connection node_2
SET wsrep_on=OFF; SET SESSION wsrep_on=OFF;
DROP SCHEMA test; DROP SCHEMA test;
--connection node_3 --connection node_3
SET wsrep_on=OFF; SET SESSION wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb;
# #
# 2. The following should generate different errors on nodes 2 and 3 and # 2. The following should generate different errors on nodes 2 and 3 and
...@@ -27,10 +29,10 @@ CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; ...@@ -27,10 +29,10 @@ CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb;
# #
--connection node_1 --connection node_1
CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE test.t1 (f1 INTEGER NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO test.t1 values (1);
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc --source include/wait_condition.inc
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' --let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
--source include/wait_condition.inc --source include/wait_condition.inc
SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_cluster_status';
......
...@@ -193,6 +193,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this ...@@ -193,6 +193,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this
CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\.");
CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("Failed to initialize plugins\\.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)");
...@@ -207,6 +208,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this ...@@ -207,6 +208,7 @@ CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this
CALL mtr.add_suppression("Aborting"); CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\.");
CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\.");
CALL mtr.add_suppression("Failed to initialize plugins\\."); CALL mtr.add_suppression("Failed to initialize plugins\\.");
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)");
......
...@@ -33,7 +33,7 @@ export PATH="/usr/sbin:/sbin:$PATH" ...@@ -33,7 +33,7 @@ export PATH="/usr/sbin:/sbin:$PATH"
. $(dirname "$0")/wsrep_sst_common . $(dirname "$0")/wsrep_sst_common
MAGIC_FILE="$WSREP_SST_OPT_DATA/backup_sst_complete" MAGIC_FILE="$WSREP_SST_OPT_DATA/backup_sst_complete"
rm -rf "$MAGIC_FILE" rm -r "$MAGIC_FILE"
WSREP_LOG_DIR=${WSREP_LOG_DIR:-""} WSREP_LOG_DIR=${WSREP_LOG_DIR:-""}
# if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf # if WSREP_LOG_DIR env. variable is not set, try to get it from my.cnf
......
...@@ -106,6 +106,7 @@ DATA="$WSREP_SST_OPT_DATA" ...@@ -106,6 +106,7 @@ DATA="$WSREP_SST_OPT_DATA"
INFO_FILE='xtrabackup_galera_info' INFO_FILE='xtrabackup_galera_info'
DONOR_INFO_FILE='donor_galera_info' DONOR_INFO_FILE='donor_galera_info'
IST_FILE='xtrabackup_ist' IST_FILE='xtrabackup_ist'
MAGIC_FILE="$DATA/$INFO_FILE" MAGIC_FILE="$DATA/$INFO_FILE"
DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE" DONOR_MAGIC_FILE="$DATA/$DONOR_INFO_FILE"
...@@ -686,16 +687,16 @@ cleanup_at_exit() ...@@ -686,16 +687,16 @@ cleanup_at_exit()
fi fi
if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then
wsrep_log_info "Removing the sst_in_progress file"
wsrep_cleanup_progress_file
else
if [ -n "$BACKUP_PID" ]; then if [ -n "$BACKUP_PID" ]; then
if check_pid "$BACKUP_PID" 1; then if check_pid $BACKUP_PID; then
wsrep_log_error \ wsrep_log_error \
"mariadb-backup process is still running. Killing..." "mariadb-backup process is still running. Killing..."
cleanup_pid $CHECK_PID "$BACKUP_PID" cleanup_pid $CHECK_PID
fi fi
fi fi
wsrep_log_info "Removing the sst_in_progress file"
wsrep_cleanup_progress_file
else
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || :
fi fi
...@@ -919,9 +920,6 @@ monitor_process() ...@@ -919,9 +920,6 @@ monitor_process()
done done
} }
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
[ -f "$DONOR_MAGIC_FILE" ] && rm -rf "$DONOR_MAGIC_FILE"
read_cnf read_cnf
setup_ports setup_ports
...@@ -1071,6 +1069,24 @@ get_transfer ...@@ -1071,6 +1069,24 @@ get_transfer
findopt='-L' findopt='-L'
[ "$OS" = 'FreeBSD' ] && findopt="$findopt -E" [ "$OS" = 'FreeBSD' ] && findopt="$findopt -E"
SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
while check_pid "$SST_PID" 0; do
wsrep_log_info "previous SST is not completed, waiting for it to exit"
check_round=$(( check_round+1 ))
if [ $check_round -eq 30 ]; then
wsrep_log_error "previous SST script still running."
exit 114 # EALREADY
fi
sleep 1
done
[ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE"
[ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE"
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE"
if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
trap cleanup_at_exit EXIT trap cleanup_at_exit EXIT
...@@ -1204,9 +1220,6 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then ...@@ -1204,9 +1220,6 @@ if [ "$WSREP_SST_OPT_ROLE" = 'donor' ]; then
exit 22 exit 22
fi fi
# mariadb-backup implicitly writes PID to fixed location in $xtmpdir
BACKUP_PID="$xtmpdir/xtrabackup_pid"
else # BYPASS FOR IST else # BYPASS FOR IST
wsrep_log_info "Bypassing the SST for IST" wsrep_log_info "Bypassing the SST for IST"
...@@ -1319,33 +1332,12 @@ else # joiner ...@@ -1319,33 +1332,12 @@ else # joiner
impts="--parallel=$backup_threads${impts:+ }$impts" impts="--parallel=$backup_threads${impts:+ }$impts"
fi fi
SST_PID="$DATA/wsrep_sst.pid"
# give some time for previous SST to complete:
check_round=0
while check_pid "$SST_PID" 0; do
wsrep_log_info "previous SST is not completed, waiting for it to exit"
check_round=$(( check_round+1 ))
if [ $check_round -eq 10 ]; then
wsrep_log_error "previous SST script still running."
exit 114 # EALREADY
fi
sleep 1
done
trap simple_cleanup EXIT trap simple_cleanup EXIT
echo $$ > "$SST_PID" echo $$ > "$SST_PID"
stagemsg='Joiner-Recv' stagemsg='Joiner-Recv'
MODULE="${WSREP_SST_OPT_MODULE:-xtrabackup_sst}" MODULE="${WSREP_SST_OPT_MODULE:-xtrabackup_sst}"
[ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE"
# May need xtrabackup_checkpoints later on
[ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary"
[ -f "$DATA/xtrabackup_galera_info" ] && rm -f "$DATA/xtrabackup_galera_info"
ADDR="$WSREP_SST_OPT_HOST" ADDR="$WSREP_SST_OPT_HOST"
if [ "${tmode#VERIFY}" != "$tmode" ]; then if [ "${tmode#VERIFY}" != "$tmode" ]; then
...@@ -1376,6 +1368,7 @@ else # joiner ...@@ -1376,6 +1368,7 @@ else # joiner
STATDIR="$(mktemp -d)" STATDIR="$(mktemp -d)"
MAGIC_FILE="$STATDIR/$INFO_FILE" MAGIC_FILE="$STATDIR/$INFO_FILE"
DONOR_MAGIC_FILE="$STATDIR/$DONOR_INFO_FILE"
recv_joiner "$STATDIR" "$stagemsg-gtid" $stimeout 1 1 recv_joiner "$STATDIR" "$stagemsg-gtid" $stimeout 1 1
...@@ -1406,7 +1399,7 @@ else # joiner ...@@ -1406,7 +1399,7 @@ else # joiner
fi fi
mkdir -p "$DATA/.sst" mkdir -p "$DATA/.sst"
(recv_joiner "$DATA/.sst" "$stagemsg-SST" 0 0 0) & (recv_joiner "$DATA/.sst" "$stagemsg-SST" 0 0 0) &
jpid=$! BACKUP_PID=$!
wsrep_log_info "Proceeding with SST" wsrep_log_info "Proceeding with SST"
get_binlog get_binlog
...@@ -1449,12 +1442,21 @@ else # joiner ...@@ -1449,12 +1442,21 @@ else # joiner
"$DATA" -mindepth 1 -prune -regex "$cpat" \ "$DATA" -mindepth 1 -prune -regex "$cpat" \
-o -exec rm -rf {} >&2 \+ -o -exec rm -rf {} >&2 \+
# Deleting files from previous SST and legacy files from old versions:
[ -f "$DATA/xtrabackup_binary" ] && rm -f "$DATA/xtrabackup_binary"
[ -f "$DATA/xtrabackup_pid" ] && rm -f "$DATA/xtrabackup_pid"
[ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints"
[ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info"
# [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info"
[ -f "$DATA/xtrabackup_binlog_pos_innodb" ] && rm -f "$DATA/xtrabackup_binlog_pos_innodb"
TDATA="$DATA" TDATA="$DATA"
DATA="$DATA/.sst" DATA="$DATA/.sst"
MAGIC_FILE="$DATA/$INFO_FILE" MAGIC_FILE="$DATA/$INFO_FILE"
wsrep_log_info "Waiting for SST streaming to complete!" wsrep_log_info "Waiting for SST streaming to complete!"
monitor_process $jpid monitor_process $BACKUP_PID
BACKUP_PID=""
if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then if [ ! -s "$DATA/xtrabackup_checkpoints" ]; then
wsrep_log_error "xtrabackup_checkpoints missing," \ wsrep_log_error "xtrabackup_checkpoints missing," \
...@@ -1562,6 +1564,7 @@ else # joiner ...@@ -1562,6 +1564,7 @@ else # joiner
fi fi
MAGIC_FILE="$TDATA/$INFO_FILE" MAGIC_FILE="$TDATA/$INFO_FILE"
DONOR_MAGIC_FILE="$TDATA/$DONOR_INFO_FILE"
wsrep_log_info "Moving the backup to $TDATA" wsrep_log_info "Moving the backup to $TDATA"
timeit 'mariadb-backup move stage' "$INNOMOVE" timeit 'mariadb-backup move stage' "$INNOMOVE"
...@@ -1586,7 +1589,8 @@ else # joiner ...@@ -1586,7 +1589,8 @@ else # joiner
fi fi
if [ ! -r "$MAGIC_FILE" ]; then if [ ! -r "$MAGIC_FILE" ]; then
wsrep_log_error "SST magic file '$MAGIC_FILE' not found/readable" wsrep_log_error "Internal error: SST magic file '$MAGIC_FILE'" \
"not found or not readable"
exit 2 exit 2
fi 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