| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Bug #19451053 CRASH AFTER DIRECT INSERT INTO MYSQL.GTID_EXECUTED TABLE |
| 4 |
# |
| 5 |
# Verify that push a warning to client if user is modifying |
| 6 |
# the gtid_executed table explicitly, ignore the duplicate |
| 7 |
# key error and log a warning for it when writing transaction |
| 8 |
# owned GTID into gtid_executed table within the transaction |
| 9 |
# implicitly. |
| 10 |
# |
| 11 |
|
| 12 |
# Test in this file is binlog format agnostic, thus no need |
| 13 |
# to rerun them for every format. |
| 14 |
--source include/have_binlog_format_statement.inc |
| 15 |
--source include/master-slave.inc |
| 16 |
--let $uuida=aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
| 17 |
--echo # |
| 18 |
--echo # Verify that explicit insert into mysql.gtid_executed |
| 19 |
--echo # is causing a warning. |
| 20 |
--echo # |
| 21 |
--eval INSERT INTO mysql.gtid_executed VALUES ('$uuida', 1, 1) |
| 22 |
--echo # |
| 23 |
--echo # Verify that explicit update to mysql.gtid_executed |
| 24 |
--echo # is causing a warning. |
| 25 |
--echo # |
| 26 |
--eval UPDATE mysql.gtid_executed SET interval_end = 2 WHERE source_uuid = '$uuida' |
| 27 |
--echo # |
| 28 |
--echo # Verify that explicit select from mysql.gtid_executed |
| 29 |
--echo # with 'FOR UPDATE' is causing a warning. |
| 30 |
--echo # |
| 31 |
--eval SELECT * FROM mysql.gtid_executed WHERE source_uuid = '$uuida' FOR UPDATE |
| 32 |
--echo # |
| 33 |
--echo # Verify that explicit delete from mysql.gtid_executed |
| 34 |
--echo # is causing a warning. |
| 35 |
--echo # |
| 36 |
--eval DELETE FROM mysql.gtid_executed WHERE source_uuid = '$uuida' |
| 37 |
--echo # |
| 38 |
--echo # Verify that no warning on explicit select from mysql.gtid_executed |
| 39 |
--echo # |
| 40 |
--eval SELECT * FROM mysql.gtid_executed WHERE source_uuid = '$uuida' |
| 41 |
|
| 42 |
|
| 43 |
--source include/sync_slave_sql_with_master.inc |
| 44 |
call mtr.add_suppression("You need to use --log-bin to make " |
| 45 |
"--binlog-format work"); |
| 46 |
call mtr.add_suppression("The transaction owned GTID is already in the " |
| 47 |
"gtid_executed table, which is caused by an " |
| 48 |
"explicit modifying from user client."); |
| 49 |
--eval INSERT INTO mysql.gtid_executed VALUES ('$uuida', 1, 1) |
| 50 |
--echo # |
| 51 |
--echo # Verify that the GTID is inserted into table, but |
| 52 |
--echo # is not inserted into GLOBAL.GTID_EXECUTED. |
| 53 |
--echo # |
| 54 |
SELECT * FROM mysql.gtid_executed; |
| 55 |
SELECT @@GLOBAL.GTID_EXECUTED; |
| 56 |
--echo # |
| 57 |
--echo # Verify that the duplicate error is ignored, the transaction |
| 58 |
--echo # is committed successfully, the GTID is inserted into |
| 59 |
--echo # GLOBAL.GTID_EXECUTED, and log a warning in error log. |
| 60 |
--echo # |
| 61 |
--eval SET GTID_NEXT = '$uuida:1' |
| 62 |
|
| 63 |
CREATE TABLE t1 (a INT); |
| 64 |
SELECT @@GLOBAL.GTID_EXECUTED; |
| 65 |
SET GTID_NEXT = 'AUTOMATIC'; |
| 66 |
FLUSH LOGS; |
| 67 |
|
| 68 |
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.2.err |
| 69 |
--let $assert_match = .*The transaction owned GTID is already in the gtid_executed table, which is caused by an explicit modifying from user client.* |
| 70 |
--let $assert_select = The transaction owned GTID is already in the gtid_executed table, which is caused by an explicit modifying from user client |
| 71 |
--let $assert_text = Found the expected warning "The transaction owned GTID is already in the gtid_executed table, which is caused by an explicit modifying from user client" in slave's error log. |
| 72 |
--source include/assert_grep.inc |
| 73 |
|
| 74 |
--eval SET GTID_NEXT = '$uuida:2' |
| 75 |
DROP TABLE t1; |
| 76 |
SELECT @@GLOBAL.GTID_EXECUTED; |
| 77 |
|
| 78 |
# Cleanup |
| 79 |
--source include/rpl_connection_master.inc |
| 80 |
--source include/rpl_end.inc |