File: rpl_atomic_ddl_rollback.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (125 lines) | stat: -rw-r--r-- 4,786 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# ==== 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/set_privilege_checks_user_as_system_user.inc
--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 source and the replica");
CALL mtr.add_suppression("Query caused different errors on source and replica.");
CALL mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state.");
CALL mtr.add_suppression("Replica 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_count= 2
--let $assert_select= (Replica:|Worker).*A commit for an atomic DDL statement was unsuccessful on the source and the replica
--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