Debian Codegraph @

mysql-test/suite/rpl/t/rpl_create_drop_temp_table.test

raw
1 ###############################################################################
2 # Bug#18364070 BACKPORT BUG#18236612 TO MYSQL-5.6
3 # Problem & Analysis : When Slave SQL thread detects that Master was restarted
4 # with the help of information sent by Master through 'FormatDescription'
5 # event, slave SQL drops all the opened temporary tables in order to have
6 # proper cleanup. While slave SQL thread is dropping the temporary tables, it
7 # is not decrementing Replica_open_temp_tables count.
8 # Fix: Decrement Replica_open_temp_tables count in this case.
9 # Steps to test:
10 # 1) Create a temporary table
11 # 2) Sync it with slave
12 # 3) Stop slave io thread
13 # 4) Kill Master which generates Format Description event
14 # 5) Restart Master again
15 # 6) Start slave io thread
16 # 7) Wait till SQL thread applies all events
17 # (which includes newly generated Format Description event)
18 # 8) Now verify that Replica_open_temp_tables has '0' value
19
20 # This same test steps with gtid enabled mode, works to test the following
21 # bug as well.
22 # Bug#18069107 SLAVE CRASHES WITH GTIDS,TEMP TABLE, STOP IO_THREAD, START SLAVE
23 # Problem & Analysis : When Slave SQL thread detects that Master was restarted
24 # with the help of information sent by Master through 'FormatDescription'
25 # event, slave SQL drops all the opened temporary tables in order to have
26 # proper cleanup. When Gtid mode is on and while slave SQL thread is
27 # generating DROP TEMPORARY statement for all these temporary tables,
28 # server is hitting an assert DEBUG_ASSERT(gtid.spec_type != UNDEF_GROUP)
29 ###############################################################################
30
31 # Statement mode is enough (row based temporary
32 # tables are not replicated)
33 --source include/have_binlog_format_statement.inc
34 --source include/master-slave.inc
35
36 # 1. Create a temporary table
37 CREATE TEMPORARY TABLE temp (i INT);
38
39 # 2. Sync it with slave
40 --sync_slave_with_master
41
42 # 3. Stop slave io thread
43 --source include/stop_slave_io.inc
44
45 # 4. Kill Master so that it does not go through THD::cleanup logic. Hence it does
46 # not generate "drop temporary" query for 'temp' table.
47 --let $rpl_server_number= 1
48 --let $rpl_force_stop=1
49 --source include/rpl_stop_server.inc
50
51 # 5. Restart Master (generates Format Description event which tells slave to
52 # drop all temporary tables)
53 --source include/rpl_start_server.inc
54
55 # 6. Start slave io_thread
56 --connection slave
57 --source include/start_slave_io.inc
58 --connection master
59 --source include/sync_slave_io_with_master.inc
60
61 # 7. Wait for slave thread to apply all events (including the newly generated
62 # FormatDescription event which tells slave SQL thread to drop all temporary
63 --let $show_statement= SHOW PROCESSLIST
64 --let $field= State
65 --let $condition= = 'Replica has read all relay log; waiting for more updates';
66 --source include/wait_show_condition.inc
67
68 # 8.Now if we verify replica_open_temp_tables, it should be '0'
69 --let $var_value= query_get_value(SHOW STATUS LIKE 'Replica_open_temp_tables', Value, 1)
70 --let $assert_text= Replica_open_temp_tables should be 0
71 --let $assert_cond= $var_value = 0
72 --source include/assert.inc
73
74 --source include/rpl_end.inc