126 lines
4.7 KiB
Plaintext
126 lines
4.7 KiB
Plaintext
# ==== Purpose ====
|
|
#
|
|
# This test uses a binlog generated in a 5.7 server with a ER_BAD_TABLE_ERROR to
|
|
# check that the slave issues an error when an atomic DDL was replicated to the
|
|
# slave but was not successfully applied.
|
|
#
|
|
# ==== References ====
|
|
#
|
|
# BUG#26133488 SLAVE IS DIVERGED FROM MASTER BUT CROSS-VERSION RPL CONTINUES
|
|
# WITHOUT ERROR
|
|
#
|
|
|
|
# the 5.7 master binlog file was only recorded in statement format
|
|
--source include/have_binlog_format_statement.inc
|
|
--let $rpl_gtid_utils= 1
|
|
--let $rpl_skip_start_slave= 1
|
|
--source include/master-slave.inc
|
|
|
|
# add suppressions to the slave for expected errors/warnings
|
|
--source include/rpl_connection_slave.inc
|
|
CALL mtr.add_suppression("Unknown table");
|
|
CALL mtr.add_suppression("A commit for an atomic DDL statement was unsuccessful on the master and the slave");
|
|
CALL mtr.add_suppression("Query caused different errors on master and slave.");
|
|
CALL mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state.");
|
|
CALL mtr.add_suppression("Slave worker thread has failed to apply an event. As a consequence, the coordinator thread is stopping execution.");
|
|
|
|
--let $MYSQLD_SLAVE_DATADIR= `select @@datadir`
|
|
|
|
# clear slave datadir
|
|
RESET SLAVE;
|
|
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001
|
|
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
|
|
|
|
# copy the binlog with the following statements:
|
|
# --source include/have_binlog_format_statement.inc
|
|
# CREATE TABLE t1 (a INT);
|
|
# --error ER_BAD_TABLE_ERROR
|
|
# DROP TABLE t1, t2;
|
|
|
|
# on Win* platforms path separator is backslash
|
|
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
|
|
{
|
|
--copy_file std_data/slave-relay-bin_win.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
|
|
}
|
|
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
|
|
{
|
|
--copy_file std_data/slave-relay-bin_linux.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
|
|
}
|
|
|
|
--copy_file std_data/rpl_atomic_ddl_rollback_table.000001 $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001
|
|
|
|
START SLAVE;
|
|
|
|
--let $slave_sql_errno= convert_error(ER_INCONSISTENT_ERROR)
|
|
--source include/wait_for_slave_sql_error.inc
|
|
|
|
--source include/stop_slave.inc
|
|
--let $disjoint_value= `SELECT GTID_IS_DISJOINT('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1', @@GLOBAL.GTID_EXECUTED)`
|
|
--let $assert_text= Check that the failed ddl was rollbacked and is not in the slave gtid_executed set
|
|
--let $assert_cond= $disjoint_value = 1
|
|
--source include/assert.inc
|
|
|
|
# clean up slave
|
|
RESET SLAVE;
|
|
SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1';
|
|
BEGIN;
|
|
COMMIT;
|
|
SET GTID_NEXT= AUTOMATIC;
|
|
--source include/start_slave.inc
|
|
DROP TABLE t1;
|
|
|
|
|
|
--source include/stop_slave.inc
|
|
RESET SLAVE;
|
|
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001
|
|
--remove_file $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
|
|
|
|
# copy the binlog with the following statements:
|
|
# --source include/have_binlog_format_statement.inc
|
|
# CREATE VIEW v1 as SELECT 1;
|
|
# --error ER_BAD_TABLE_ERROR
|
|
# DROP VIEW v1, v2;
|
|
|
|
# on Win* platforms path separator is backslash
|
|
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
|
|
{
|
|
--copy_file std_data/slave-relay-bin_win.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
|
|
}
|
|
if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
|
|
{
|
|
--copy_file std_data/slave-relay-bin_linux.index $MYSQLD_SLAVE_DATADIR/slave-relay-bin.index
|
|
}
|
|
|
|
--copy_file std_data/rpl_atomic_ddl_rollback_view.000001 $MYSQLD_SLAVE_DATADIR/slave-relay-bin.000001
|
|
|
|
START SLAVE;
|
|
|
|
--let $slave_sql_errno= convert_error(ER_INCONSISTENT_ERROR)
|
|
--source include/wait_for_slave_sql_error.inc
|
|
|
|
--let $disjoint_value= `SELECT GTID_IS_DISJOINT('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2', @@GLOBAL.GTID_EXECUTED)`
|
|
--let $assert_text= Check that the failed ddl was rollbacked and is not in the slave gtid_executed set
|
|
--let $assert_cond= $disjoint_value = 1
|
|
--source include/assert.inc
|
|
|
|
# clean up slave
|
|
--source include/stop_slave.inc
|
|
RESET SLAVE;
|
|
SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2';
|
|
BEGIN;
|
|
COMMIT;
|
|
SET GTID_NEXT= AUTOMATIC;
|
|
--source include/start_slave.inc
|
|
DROP VIEW v1;
|
|
|
|
# check that the error is present twice in the error log, once per not applied
|
|
# atomic ddl
|
|
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err
|
|
--let $assert_only_after= CURRENT_TEST: rpl_gtid.rpl_atomic_ddl_rollback
|
|
--let $assert_count= 2
|
|
--let $assert_select= (Slave:|Worker).*A commit for an atomic DDL statement was unsuccessful on the master and the slave
|
|
--let $assert_text= There shall be an error when the master is 5.7-, the slave is 8.0+, and the latter fails to apply an atomic DDL
|
|
--source include/assert_grep.inc
|
|
|
|
--source include/rpl_end.inc
|