| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Bug #18963676 MISSED TO HANDLE OOM ERROR WHILE ADDING A GTID INTO GTID SET |
| 4 |
# |
| 5 |
# Verify that we can get correct global @@GTID_EXECUTED after server |
| 6 |
# restarts from a crash caused by 'OUT OF MEMORY' error on adding |
| 7 |
# GTID into global @@GTID_EXECUTED. |
| 8 |
# |
| 9 |
# ==== Implementation ==== |
| 10 |
# |
| 11 |
# 1) Commit a transaction on master. |
| 12 |
# 2) Wait the slave server crash caused by 'OUT OF MEMORY' error |
| 13 |
# on adding GTID into @@GLOBAL.GTID_EXECUTED when applying |
| 14 |
# the replicated transaction. |
| 15 |
# 3) Verify that the transaction is committed and its GTID is |
| 16 |
# added into @@GLOBAL.GTID_EXECUTED and 'gtid_executed' |
| 17 |
# table after slave server restarts. |
| 18 |
# |
| 19 |
|
| 20 |
# Test in this file is binlog format agnostic, thus no need |
| 21 |
# to rerun them for every format. |
| 22 |
--source include/have_binlog_format_row.inc |
| 23 |
--source include/not_group_replication_plugin.inc |
| 24 |
--source include/master-slave.inc |
| 25 |
# Restrict the test runs to only debug builds, since we set DEBUG point in the test. |
| 26 |
--source include/have_debug.inc |
| 27 |
# Test simulates OOM condition and hence should not be run with valgrind |
| 28 |
-- source include/not_valgrind.inc |
| 29 |
|
| 30 |
--source include/rpl_connection_slave.inc |
| 31 |
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work"); |
| 32 |
|
| 33 |
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect |
| 34 |
|
| 35 |
--let $debug_point= rpl_gtid_update_on_commit_simulate_out_of_memory |
| 36 |
--source include/add_debug_point.inc |
| 37 |
|
| 38 |
--source include/rpl_connection_master.inc |
| 39 |
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID` |
| 40 |
--echo # |
| 41 |
--echo # Commit a transaction on master |
| 42 |
--echo # |
| 43 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 44 |
|
| 45 |
--source include/rpl_connection_slave.inc |
| 46 |
--echo # |
| 47 |
--echo # Wait the slave server crash caused by 'OUT OF MEMORY' error |
| 48 |
--echo # on adding GTID into @@GLOBAL.GTID_EXECUTED when applying |
| 49 |
--echo # the replicated transaction. |
| 50 |
--echo # |
| 51 |
--source include/wait_until_disconnected.inc |
| 52 |
--let $rpl_server_number= 2 |
| 53 |
--source include/rpl_start_server.inc |
| 54 |
|
| 55 |
--echo # |
| 56 |
--echo # Verify that the transaction is committed and its GTID is |
| 57 |
--echo # added into @@GLOBAL.GTID_EXECUTED and 'gtid_executed' |
| 58 |
--echo # table after slave server restarts. |
| 59 |
--echo # |
| 60 |
|
| 61 |
# No need to unset the debug point as the server restarted |
| 62 |
|
| 63 |
--replace_result $master_uuid MASTER_UUID |
| 64 |
--eval SELECT * FROM mysql.gtid_executed |
| 65 |
--let $assert_text= committed gtids MASTER_UUID:1 |
| 66 |
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1" |
| 67 |
|
| 68 |
--let $assert_text= Table t1 exists and is empty |
| 69 |
--let $assert_cond= "[SELECT c1 FROM t1]" = "" |
| 70 |
--source include/assert.inc |
| 71 |
--source include/start_slave.inc |
| 72 |
|
| 73 |
# Cleanup |
| 74 |
--source include/rpl_connection_master.inc |
| 75 |
DROP TABLE t1; |
| 76 |
--source include/rpl_end.inc |
| 77 |
|