summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Nielsen <knielsen@knielsen-hq.org>2017-04-20 16:22:21 +0200
committerKristian Nielsen <knielsen@knielsen-hq.org>2017-04-21 10:30:17 +0200
commit1b54cb3b7741548a02ff520d730dcab140d60777 (patch)
tree56942de324f4c2945748c6d499f86d5696bb7c5b
parent8953c7e48426671f8fb3a68cae22eb7a00cfee61 (diff)
downloadmariadb-git-1b54cb3b7741548a02ff520d730dcab140d60777.tar.gz
MDEV-12179: Per-engine mysql.gtid_slave_pos table
Intermediate commit. Update some existing test cases to work with the new handling of mysql.gtid_slave_pos* tables: - The tables are now checked during START SLAVE, which causes some errors or error injections to trigger differently. - Some test cases that play games with renaming or altering the mysql.gtid_slave_pos table need adjustments.
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_crash.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_stop_start.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_until.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_crash.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test19
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_stop_start.test18
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_until.test3
8 files changed, 37 insertions, 31 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
index 7b6e95bf718..ed2a2b287e9 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
@@ -88,16 +88,16 @@ include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,crash_commit_before";
START SLAVE;
+SET GLOBAL debug_dbug="+d,crash_commit_before";
connection server_1;
INSERT INTO t1 VALUES (5);
include/save_master_gtid.inc
connection server_2;
include/sync_with_master_gtid.inc
include/stop_slave.inc
-SET GLOBAL debug_dbug="+d,crash_commit_after";
START SLAVE;
+SET GLOBAL debug_dbug="+d,crash_commit_after";
connection server_1;
INSERT INTO t1 VALUES (6);
include/save_master_gtid.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
index 7c2471ba37c..04c3fa7966f 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
@@ -8,26 +8,22 @@ connection slave;
include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
START SLAVE;
+ERROR HY000: Failed to open mysql.gtid_slave_pos
connection master;
INSERT INTO t1 VALUES (1);
connection slave;
-CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
-include/wait_for_slave_sql_error.inc [errno=1942]
-include/stop_slave.inc
+CALL mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos");
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
START SLAVE;
-include/wait_for_slave_sql_error.inc [errno=1942]
-include/stop_slave.inc
+ERROR HY000: Failed to open mysql.gtid_slave_pos
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
START SLAVE;
-include/wait_for_slave_sql_error.inc [errno=1942]
-include/stop_slave.inc
+ERROR HY000: Failed to open mysql.gtid_slave_pos
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
START SLAVE;
-include/wait_for_slave_sql_error.inc [errno=1942]
-include/stop_slave.inc
+ERROR HY000: Failed to open mysql.gtid_slave_pos
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id);
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
index 3f3b5e4344a..ff845794c22 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
@@ -194,7 +194,7 @@ domain_id COUNT(*)
*** MDEV-4650: show variables; ERROR 1946 (HY000): Failed to load replication slave GTID position ***
connection server_2;
SET sql_log_bin=0;
-RENAME TABLE mysql.gtid_slave_pos TO mysql.gtid_slave_pos_old;
+RENAME TABLE mysql.gtid_slave_pos TO mysql.old_gtid_slave_pos;
SET sql_log_bin=1;
SHOW VARIABLES;
SHOW VARIABLES LIKE 'gtid_slave_pos';
@@ -207,7 +207,7 @@ Level Code Message
Error 1146 Table 'mysql.gtid_slave_pos' doesn't exist
Error 1946 Failed to load replication slave GTID position from table mysql.gtid_slave_pos
SET sql_log_bin=0;
-RENAME TABLE mysql.gtid_slave_pos_old TO mysql.gtid_slave_pos;
+RENAME TABLE mysql.old_gtid_slave_pos TO mysql.gtid_slave_pos;
CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
SET sql_log_bin=1;
SHOW VARIABLES LIKE 'gtid_slave_pos';
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_until.result b/mysql-test/suite/rpl/r/rpl_gtid_until.result
index 886f6cfd2cb..2295aad34ac 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_until.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_until.result
@@ -10,6 +10,8 @@ SET s= SUBSTR(s FROM 1 FOR LOCATE(",", s) - 1);
RETURN s;
END|
connection server_2;
+include/stop_slave.inc
+include/start_slave.inc
START SLAVE UNTIL master_gtid_pos = "";
ERROR HY000: Slave is already running
include/stop_slave_io.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
index b81cbd38cd3..5cf28b6e49a 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test
@@ -161,8 +161,8 @@ EOF
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
-SET GLOBAL debug_dbug="+d,crash_commit_before";
START SLAVE;
+SET GLOBAL debug_dbug="+d,crash_commit_before";
--connection server_1
INSERT INTO t1 VALUES (5);
@@ -185,8 +185,8 @@ EOF
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
-SET GLOBAL debug_dbug="+d,crash_commit_after";
START SLAVE;
+SET GLOBAL debug_dbug="+d,crash_commit_after";
--connection server_1
INSERT INTO t1 VALUES (6);
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
index 05da466597e..a5946411144 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_errorhandling.test
@@ -10,37 +10,28 @@ CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
--connection slave
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no VARCHAR(20);
+--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
--connection master
INSERT INTO t1 VALUES (1);
--connection slave
-CALL mtr.add_suppression("Slave: Failed to open mysql.gtid_slave_pos");
---let $slave_sql_errno=1942
---source include/wait_for_slave_sql_error.inc
-
---source include/stop_slave.inc
+CALL mtr.add_suppression("Incorrect definition of table mysql.gtid_slave_pos");
ALTER TABLE mysql.gtid_slave_pos CHANGE seq_no seq_no BIGINT UNSIGNED NOT NULL;
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id, domain_id);
+--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
---let $slave_sql_errno=1942
---source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
+--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
---let $slave_sql_errno=1942
---source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (sub_id);
+--error ER_GTID_OPEN_TABLE_FAILED
START SLAVE;
---let $slave_sql_errno=1942
---source include/wait_for_slave_sql_error.inc
---source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos DROP PRIMARY KEY;
ALTER TABLE mysql.gtid_slave_pos ADD PRIMARY KEY (domain_id, sub_id);
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
index 09b35011f1f..309debd87c5 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test
@@ -232,6 +232,20 @@ EOF
SET sql_log_bin= 0;
ALTER TABLE mysql.gtid_slave_pos ENGINE=MyISAM;
SET sql_log_bin= 1;
+# Do a second restart to get the mysql.gtid_slave_pos table loaded with
+# the right engine.
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+wait
+EOF
+--shutdown_server 30
+--source include/wait_until_disconnected.inc
+
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
+restart:
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
--source include/start_slave.inc
--connection server_1
@@ -285,7 +299,7 @@ SELECT domain_id, COUNT(*) FROM mysql.gtid_slave_pos GROUP BY domain_id;
--connection server_2
SET sql_log_bin=0;
--let $old_pos= `SELECT @@GLOBAL.gtid_slave_pos`
-RENAME TABLE mysql.gtid_slave_pos TO mysql.gtid_slave_pos_old;
+RENAME TABLE mysql.gtid_slave_pos TO mysql.old_gtid_slave_pos;
SET sql_log_bin=1;
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
@@ -313,7 +327,7 @@ SHOW WARNINGS;
# Restore things.
SET sql_log_bin=0;
-RENAME TABLE mysql.gtid_slave_pos_old TO mysql.gtid_slave_pos;
+RENAME TABLE mysql.old_gtid_slave_pos TO mysql.gtid_slave_pos;
CALL mtr.add_suppression("Failed to load slave replication state from table mysql.gtid_slave_pos");
SET sql_log_bin=1;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_until.test b/mysql-test/suite/rpl/t/rpl_gtid_until.test
index 20d4510ccc8..aa05ecf79ab 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_until.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_until.test
@@ -19,6 +19,9 @@ delimiter ;|
--connection server_2
--sync_with_master
+# Restart SQL thread to pick up ALTER TABLE of mysql.gtid_slave_pos.
+--source include/stop_slave.inc
+--source include/start_slave.inc
# Both replication threads must be stopped for UNTIL master_gtid_pos.
--error ER_SLAVE_WAS_RUNNING