Merge branch '10.6' into 10.7

This commit is contained in:
Sergei Golubchik 2022-05-11 11:25:33 +02:00
commit fd132be117
284 changed files with 7485 additions and 1878 deletions

View file

@ -0,0 +1,14 @@
--disable_query_log
--file_exists $targetdir/xtrabackup_slave_info
CREATE TEMPORARY TABLE tmp_slave_info(lineno SERIAL, line TEXT);
--replace_result $targetdir TARGETDIR
--eval LOAD DATA LOCAL INFILE '$targetdir/xtrabackup_slave_info' INTO TABLE tmp_slave_info (line);
SELECT
lineno,
regexp_replace(
regexp_replace(line, '(?<=MASTER_LOG_POS=)[0-9]+', '<NUM>'),
'[0-9]+-[0-9]+-[0-9]+', '<NUM-NUM-NUM>')
AS line
FROM tmp_slave_info ORDER BY lineno;
DROP TEMPORARY TABLE tmp_slave_info;
--enable_query_log

View file

@ -0,0 +1,20 @@
--disable_query_log
--file_exists $XTRABACKUP_OUT
CREATE TEMPORARY TABLE tmp_slave_info_out(lineno SERIAL, line TEXT);
--replace_result $targetdir TARGETDIR
--eval LOAD DATA LOCAL INFILE '$XTRABACKUP_OUT' INTO TABLE tmp_slave_info_out (line);
SELECT
replace(
regexp_replace(
regexp_replace(line,
'[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]',
'YYYY-MM-DD hh:mm:ss'),
'[0-9]+-[0-9]+-[0-9]+', '<NUM-NUM-NUM>'),
'\r','' /* Remove CR on Windows */)
AS line
FROM tmp_slave_info_out
WHERE line LIKE '%MySQL slave binlog position%'
OR line LIKE '%Failed to get master binlog coordinates%'
ORDER BY lineno;
DROP TEMPORARY TABLE tmp_slave_info_out;
--enable_query_log

View file

@ -0,0 +1,24 @@
call mtr.add_suppression("InnoDB: New log files created");
#
# Start of 10.2 tests
#
#
# MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken
#
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
# Prepare full backup, apply incremental one
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SELECT COUNT(*) FROM test.t1;
COUNT(*)
0
SELECT COUNT(*) FROM test1.t1;
COUNT(*)
10000
DROP TABLE t1;
DROP DATABASE test1;
#
# End of 10.2 tests
#

View file

@ -0,0 +1,47 @@
--source include/have_innodb.inc
--source include/have_debug.inc
call mtr.add_suppression("InnoDB: New log files created");
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken
--echo #
--let $basedir=$MYSQLTEST_VARDIR/tmp/backup
--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir
--enable_result_log
--let after_load_tablespaces=BEGIN NOT ATOMIC CREATE DATABASE test1; CREATE TABLE test1.t1 ENGINE=INNODB SELECT UUID() from test.seq_1_to_10000; END
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code
--let after_load_tablespaces=
--disable_result_log
--echo # Prepare full backup, apply incremental one
--exec $XTRABACKUP --prepare --target-dir=$basedir
--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir
--enable_result_log
--let $targetdir=$basedir
--source include/restart_and_restore.inc
--enable_result_log
SELECT COUNT(*) FROM test.t1;
SELECT COUNT(*) FROM test1.t1;
DROP TABLE t1;
DROP DATABASE test1;
--rmdir $basedir
--rmdir $incremental_dir
--echo #
--echo # End of 10.2 tests
--echo #

View file

@ -13,6 +13,9 @@ connection slave;
"using_gtid: Slave_Pos"
FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info
NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info
lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>';
2 CHANGE MASTER TO master_use_gtid = slave_pos;
###############
# If Using_Gtid != 'No' and !gtid_slave_pos, backup master position
########################
@ -20,6 +23,8 @@ include/stop_slave.inc
SET GLOBAL gtid_slave_pos="";
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
###############
# If Using_Gtid == 'No', backup Exec_Master_Log_Pos
########################
@ -31,6 +36,8 @@ connection slave;
"using_gtid: No"
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
connection master;
DROP TABLE t;
connection slave;

View file

@ -27,6 +27,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
@ -35,7 +36,9 @@ rmdir $targetdir;
--echo ########################
--source include/stop_slave.inc
--disable_warnings
SET GLOBAL gtid_slave_pos="";
--enable_warnings
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--disable_result_log
@ -47,6 +50,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
@ -74,6 +78,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;

View file

@ -0,0 +1,59 @@
#
# Start of 10.2 tests
#
#
# MDEV-21037 mariabackup does not detect multi-source replication slave
#
SELECT @@global.gtid_slave_pos;
@@global.gtid_slave_pos
# Without any masters the file xtrabackup_slave_info is not created
line
[00] YYYY-MM-DD hh:mm:ss Failed to get master binlog coordinates from SHOW SLAVE STATUS.This means that the server is not a replication slave. Ignoring the --slave-info option
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000;
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'
CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002;
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
2 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'; master 'master2' filename '' position '0'
SET GLOBAL gtid_slave_pos='1-1-1,2-2-2';
CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos;
CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no;
CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos;
lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>,<NUM-NUM-NUM>';
2 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos;
5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos '<NUM-NUM-NUM>,<NUM-NUM-NUM>'; master '' filename '' position '0'; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos;
lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>,<NUM-NUM-NUM>';
2 CHANGE MASTER TO master_use_gtid = slave_pos;
3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos;
5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos '<NUM-NUM-NUM>,<NUM-NUM-NUM>'; master '' master_use_gtid = slave_pos; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos
RESET SLAVE ALL;
RESET SLAVE 'master2' ALL;
RESET SLAVE 'master3' ALL;
RESET SLAVE 'master4' ALL;
RESET SLAVE 'master5' ALL;
#
# End of 10.2 tests
#

View file

@ -0,0 +1,86 @@
#
# "mariabackup --slave-info" tests that can be run without
# actually starting the replication.
#
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-21037 mariabackup does not detect multi-source replication slave
--echo #
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--let $XTRABACKUP_ARGS=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --databases=test --target-dir=$targetdir
--let $XTRABACKUP_OUT=$MYSQLTEST_VARDIR/tmp/xtrabackup_out
# Should be empty by default
SELECT @@global.gtid_slave_pos;
--echo
--echo # Without any masters the file xtrabackup_slave_info is not created
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--error 1
--file_exists $targetdir/xtrabackup_slave_info
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
SET GLOBAL gtid_slave_pos='1-1-1,2-2-2';
CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos;
CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no;
CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
RESET SLAVE ALL;
RESET SLAVE 'master2' ALL;
RESET SLAVE 'master3' ALL;
RESET SLAVE 'master4' ALL;
RESET SLAVE 'master5' ALL;
--echo #
--echo # End of 10.2 tests
--echo #