summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/mariabackup
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mysql-test/suite/mariabackup/backup_grants.result5
-rw-r--r--mysql-test/suite/mariabackup/backup_grants.test23
-rw-r--r--mysql-test/suite/mariabackup/full_backup.result8
-rw-r--r--mysql-test/suite/mariabackup/full_backup.test9
-rw-r--r--mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff2
-rw-r--r--mysql-test/suite/mariabackup/slave_provision_nolock.cnf13
-rw-r--r--mysql-test/suite/mariabackup/slave_provision_nolock.result48
-rw-r--r--mysql-test/suite/mariabackup/slave_provision_nolock.test170
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.result3
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.test3
10 files changed, 268 insertions, 16 deletions
diff --git a/mysql-test/suite/mariabackup/backup_grants.result b/mysql-test/suite/mariabackup/backup_grants.result
index 56899f8d..6bd6c9f4 100644
--- a/mysql-test/suite/mariabackup/backup_grants.result
+++ b/mysql-test/suite/mariabackup/backup_grants.result
@@ -3,12 +3,13 @@ FOUND 1 /missing required privilege RELOAD/ in backup.log
FOUND 1 /missing required privilege PROCESS/ in backup.log
FOUND 1 /GRANT USAGE ON/ in backup.log
GRANT RELOAD, PROCESS on *.* to backup@localhost;
-NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log
+FOUND 1 /missing required privilege REPLICA MONITOR/ in backup.log
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
REVOKE REPLICA MONITOR ON *.* FROM backup@localhost;
+FOUND 1 /missing required privilege CONNECTION ADMIN/ in backup.log
GRANT CONNECTION ADMIN ON *.* TO backup@localhost;
FOUND 1 /missing required privilege REPLICATION SLAVE ADMIN/ in backup.log
-NOT FOUND /missing required privilege REPLICA MONITOR/ in backup.log
+FOUND 1 /missing required privilege REPLICA MONITOR/ in backup.log
GRANT REPLICATION SLAVE ADMIN ON *.* TO backup@localhost;
GRANT REPLICA MONITOR ON *.* TO backup@localhost;
DROP USER backup@localhost;
diff --git a/mysql-test/suite/mariabackup/backup_grants.test b/mysql-test/suite/mariabackup/backup_grants.test
index 894ae73a..18db3489 100644
--- a/mysql-test/suite/mariabackup/backup_grants.test
+++ b/mysql-test/suite/mariabackup/backup_grants.test
@@ -10,7 +10,7 @@ rmdir $targetdir;
# backup fails without --no-lock, because of FTWRL
--disable_result_log
error 1;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
@@ -31,7 +31,7 @@ rmdir $targetdir;
# --slave-info and galera info require REPLICA MONITOR
--disable_result_log
error 1;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --slave-info --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
--enable_result_log
rmdir $targetdir;
@@ -47,16 +47,15 @@ REVOKE REPLICA MONITOR ON *.* FROM backup@localhost;
# TODO need a query that would delay a BACKUP STAGE START/ BACKUP STAGE BLOCK_COMMIT longer than the kill-long-queries-timeout
#--send SELECT SLEEP(9) kill_me
-## kill-long-query-type=(not empty) requires CONNECTION ADMIN
-#--disable_result_log
-#error 1;
-#--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=all --kill-long-queries-timeout=4 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log;
-#--reap
-#--enable_result_log
-#rmdir $targetdir;
-#
-#--let SEARCH_PATTERN= missing required privilege CONNECTION ADMIN
-#--source include/search_pattern_in_file.inc
+
+# kill-long-query-type=(not empty) requires CONNECTION ADMIN
+--disable_result_log
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup -ubackup --kill-long-query-type=ALL --kill-long-queries-timeout=4 --target-dir=$targetdir > $MYSQLTEST_VARDIR/tmp/backup.log 2>&1;
+--enable_result_log
+rmdir $targetdir;
+
+--let SEARCH_PATTERN= missing required privilege CONNECTION ADMIN
+--source include/search_pattern_in_file.inc
GRANT CONNECTION ADMIN ON *.* TO backup@localhost;
--disable_result_log
diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result
index 1d0dffd5..71525c22 100644
--- a/mysql-test/suite/mariabackup/full_backup.result
+++ b/mysql-test/suite/mariabackup/full_backup.result
@@ -18,6 +18,12 @@ DROP TABLE t;
#
call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 because previous shutdown was not with innodb_fast_shutdown=0");
+call mtr.add_suppression("Found 1 prepared XA transactions");
+CREATE TABLE t(f1 INT NOT NULL)ENGINE=InnoDB;
+XA START 'zombie';
+INSERT INTO t VALUES(1);
+XA END 'zombie';
+XA PREPARE 'zombie';
# restart: --innodb_undo_tablespaces=0
# xtrabackup backup
# xtrabackup prepare
@@ -28,3 +34,5 @@ call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 becaus
# Display undo log files from target directory
undo001
undo002
+XA COMMIT 'zombie';
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test
index fb043f63..c6a21112 100644
--- a/mysql-test/suite/mariabackup/full_backup.test
+++ b/mysql-test/suite/mariabackup/full_backup.test
@@ -35,6 +35,13 @@ rmdir $targetdir;
--echo #
call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
call mtr.add_suppression("InnoDB: Cannot change innodb_undo_tablespaces=0 because previous shutdown was not with innodb_fast_shutdown=0");
+call mtr.add_suppression("Found 1 prepared XA transactions");
+
+CREATE TABLE t(f1 INT NOT NULL)ENGINE=InnoDB;
+XA START 'zombie';
+INSERT INTO t VALUES(1);
+XA END 'zombie';
+XA PREPARE 'zombie';
let $restart_parameters=--innodb_undo_tablespaces=0;
--source include/restart_mysqld.inc
@@ -53,4 +60,6 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
--echo # Display undo log files from target directory
list_files $targetdir undo*;
+XA COMMIT 'zombie';
+DROP TABLE t;
rmdir $targetdir;
diff --git a/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff b/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff
index 29afd468..9ed08fcd 100644
--- a/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff
+++ b/mysql-test/suite/mariabackup/huge_lsn,strict_crc32.rdiff
@@ -1,3 +1,5 @@
+--- suite/mariabackup/huge_lsn.result
++++ suite/mariabackup/huge_lsn.reject
@@ -1,8 +1,8 @@
#
# MDEV-13416 mariabackup fails with EFAULT "Bad Address"
diff --git a/mysql-test/suite/mariabackup/slave_provision_nolock.cnf b/mysql-test/suite/mariabackup/slave_provision_nolock.cnf
new file mode 100644
index 00000000..0e0bbd63
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_provision_nolock.cnf
@@ -0,0 +1,13 @@
+[mysqld.1]
+log-slave-updates
+loose-innodb
+
+[mysqld.2]
+log-slave-updates
+loose-innodb
+
+[ENV]
+SERVER_MYPORT_1= @mysqld.1.port
+SERVER_MYSOCK_1= @mysqld.1.socket
+SERVER_MYPORT_2= @mysqld.2.port
+SERVER_MYSOCK_2= @mysqld.2.socket
diff --git a/mysql-test/suite/mariabackup/slave_provision_nolock.result b/mysql-test/suite/mariabackup/slave_provision_nolock.result
new file mode 100644
index 00000000..445a9801
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_provision_nolock.result
@@ -0,0 +1,48 @@
+call mtr.add_suppression("Can't init tc log");
+call mtr.add_suppression("Aborting");
+# restart
+RESET MASTER;
+CREATE TABLE t1(a varchar(60) PRIMARY KEY, b VARCHAR(60)) ENGINE INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+CREATE TABLE t2 (val INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0);
+connect con1,localhost,root,,;
+*** Start a background load...
+CALL gen_load();
+connection default;
+*** Doing backup...
+*** Doing prepare...
+*** Stop the background load...
+UPDATE t2 SET val=1;
+connection con1;
+connection default;
+disconnect con1;
+*** Provision a new slave from the backup
+connect server2,127.0.0.1,root,,,$SERVER_MYPORT_2;
+*** Stopping provisioned server
+*** Removing old datadir for provisioned server
+*** Provision new server from backup
+# restart
+*** Configure slave position from xtrabackup_binlog_pos_innodb
+CREATE TABLE t3 (file VARCHAR(255), pos INT) ENGINE=InnoDB;
+LOAD DATA LOCAL INFILE "BASEDIR/xtrabackup_binlog_pos_innodb"
+ INTO TABLE t3 FIELDS ESCAPED BY '' (file, pos);
+CHANGE MASTER TO
+master_port=PORT, master_host='127.0.0.1', master_user='root',
+master_log_file= "MASTER_FILE",
+master_log_pos= MASTER_POS;
+Warnings:
+Note 4190 CHANGE MASTER TO is implicitly changing the value of 'Using_Gtid' from 'Slave_Pos' to 'No'
+START SLAVE;
+connection default;
+connection server2;
+connection server2;
+STOP SLAVE;
+RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2, t3;
+connection default;
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/mariabackup/slave_provision_nolock.test b/mysql-test/suite/mariabackup/slave_provision_nolock.test
new file mode 100644
index 00000000..618f3132
--- /dev/null
+++ b/mysql-test/suite/mariabackup/slave_provision_nolock.test
@@ -0,0 +1,170 @@
+--source include/have_innodb.inc
+--source include/have_log_bin.inc
+
+call mtr.add_suppression("Can't init tc log");
+call mtr.add_suppression("Aborting");
+
+# Test provisioning a slave from an existing server, using mariabackup --no-lock
+# and the binlog position recovered from InnoDB redo log.
+
+# Update the InnoDB system tablespace to simulate a pre-10.3.5
+# position in TRX_SYS. There was a bug that the wrong position could
+# be recovered if the old filename in TRX_SYS compares newer than the
+# newer filenames stored in rseg headers.
+let MYSQLD_DATADIR=`select @@datadir`;
+let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
+
+--source include/shutdown_mysqld.inc
+
+--perl
+use strict;
+use warnings;
+use Fcntl qw(:DEFAULT :seek);
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
+do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl";
+
+my $ps = $ENV{INNODB_PAGE_SIZE};
+
+sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/ibdata1", O_RDWR
+ or die "Cannot open ibdata1: $!\n";
+
+# Read the TRX_SYS page.
+my $page;
+sysseek(IBD_FILE, $ps * 5, SEEK_SET)
+ or die "Cannot seek ibdata1: $!\n";
+sysread(IBD_FILE, $page, $ps)
+ or die "Cannot read ibdata1: $!\n";
+
+# Put in an old binlog position that will compare larger than master-bin.000001
+my $old_name= '~~~-bin.999999' . chr(0);
+my $old_off= 0xffff0000;
+my $old_magic= 873422344;
+my $binlog_offset= $ps - 1000 + 38;
+substr($page, $binlog_offset, 4)= pack('N', $old_magic);
+substr($page, $binlog_offset + 4, 4)= pack('N', ($old_off >> 32));
+substr($page, $binlog_offset + 8, 4)= pack('N', ($old_off & 0xffffffff));
+substr($page, $binlog_offset + 12, length($old_name))= $old_name;
+
+# Write back the modified page.
+my $full_crc32= get_full_crc32(\*IBD_FILE);
+$page= fix_page_crc($page, $full_crc32);
+sysseek(IBD_FILE, $ps * 5, SEEK_SET)
+ or die "Cannot seek ibdata1: $!\n";
+syswrite(IBD_FILE, $page, $ps) == $ps
+ or die "Cannot write ibdata1: $!\n";
+close IBD_FILE;
+EOF
+
+--source include/start_mysqld.inc
+
+
+let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
+
+RESET MASTER;
+CREATE TABLE t1(a varchar(60) PRIMARY KEY, b VARCHAR(60)) ENGINE INNODB;
+INSERT INTO t1 VALUES(1, NULL);
+CREATE TABLE t2 (val INT) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (0);
+
+--disable_query_log
+--delimiter //
+CREATE PROCEDURE gen_load()
+ MODIFIES SQL DATA
+ BEGIN
+ DECLARE i INT;
+ DECLARE flag TYPE OF t2.val;
+ SET i = 0;
+ load_loop: LOOP
+ SELECT val INTO flag FROM t2;
+ IF NOT (flag=0) THEN
+ LEAVE load_loop;
+ END IF;
+ START TRANSACTION;
+ INSERT INTO t1 VALUES (CONCAT("AbAdCaFe", LPAD(i, 6, "0")), @@SESSION.last_gtid);
+ COMMIT;
+ SET i = i + 1;
+ END LOOP;
+ END
+//
+--delimiter ;
+--enable_query_log
+
+connect (con1,localhost,root,,);
+--echo *** Start a background load...
+send CALL gen_load();
+
+--connection default
+--echo *** Doing backup...
+--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir --no-lock
+--echo *** Doing prepare...
+--exec $XTRABACKUP --prepare --binlog-info=1 --target-dir=$basedir
+
+--echo *** Stop the background load...
+UPDATE t2 SET val=1;
+--connection con1
+reap;
+--connection default
+disconnect con1;
+--let $count_master= `SELECT COUNT(*) FROM t1`
+
+--echo *** Provision a new slave from the backup
+--connect (server2,127.0.0.1,root,,,$SERVER_MYPORT_2)
+--let $datadir_2= `SELECT @@datadir`
+
+--echo *** Stopping provisioned server
+--source include/shutdown_mysqld.inc
+
+--echo *** Removing old datadir for provisioned server
+--rmdir $datadir_2
+
+--echo *** Provision new server from backup
+--exec $XTRABACKUP --copy-back --datadir=$datadir_2 --target-dir=$basedir
+
+# --no-lock backup might leave prepared xa transactions. rollback them.
+--error 1
+--exec $MYSQLD_LAST_CMD --tc-heuristic-recover=ROLLBACK
+--source include/start_mysqld.inc
+
+--echo *** Configure slave position from xtrabackup_binlog_pos_innodb
+CREATE TABLE t3 (file VARCHAR(255), pos INT) ENGINE=InnoDB;
+--replace_result $basedir BASEDIR
+--disable_warnings
+eval LOAD DATA LOCAL INFILE "$basedir/xtrabackup_binlog_pos_innodb"
+ INTO TABLE t3 FIELDS ESCAPED BY '' (file, pos);
+--enable_warnings
+
+# Remove leading ./ from filename (leading .\ on windows).
+--let provision_master_file= `SELECT REGEXP_REPLACE(file, "^[.].", "") FROM t3`
+--let provision_master_pos= `SELECT pos FROM t3`
+
+--replace_result $SERVER_MYPORT_1 PORT $provision_master_file MASTER_FILE $provision_master_pos MASTER_POS
+eval CHANGE MASTER TO
+ master_port=$SERVER_MYPORT_1, master_host='127.0.0.1', master_user='root',
+ master_log_file= "$provision_master_file",
+ master_log_pos= $provision_master_pos;
+START SLAVE;
+
+--connection default
+--save_master_pos
+
+--connection server2
+--sync_with_master
+--let $count_slave= `SELECT COUNT(*) FROM t1`
+if ($count_master != $count_slave) {
+ --echo *** ERROR: Table on master has $count_master rows, but table on provisioned slave has $count_slave rows
+ --die Row difference on provisioned slave.
+}
+
+# Cleanup
+
+--connection server2
+STOP SLAVE;
+RESET SLAVE ALL;
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2, t3;
+
+--connection default
+DROP PROCEDURE gen_load;
+DROP TABLE t1, t2;
+
+rmdir $basedir;
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
index d995d1be..dfcf19b6 100644
--- a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result
@@ -1,5 +1,6 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200))
+ENGINE=InnoDB PAGE_COMPRESSED=YES STATS_PERSISTENT=0;
insert into t1(b, c) values("mariadb", "mariabackup");
InnoDB 0 transactions not purged
# Corrupt the table
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
index 247a210a..700c4dd2 100644
--- a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
@@ -1,5 +1,6 @@
call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
-CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200))
+ENGINE=InnoDB PAGE_COMPRESSED=YES STATS_PERSISTENT=0;
insert into t1(b, c) values("mariadb", "mariabackup");
--source ../innodb/include/wait_all_purged.inc