Debian Codegraph @

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

raw
1 #
2 # ==== Purpose ====
3 #
4 # This test checks if the variable Replica_open_temp_tables is set
5 # to the correct number of temporary tables open in the slave and if
6 # the corresponding warning is correctly issued according to the number
7 # of temporary tables open in the channel in a multi-source scenario.
8 #
9 # ==== Implementation ====
10 #
11 # In this multi source scenario, a slave replicates from three channels.
12 # A temporary table is created in two of these three channels.
13 # Replication is stopped in the channel with no open temp table and no
14 # warning is issued. Warnings are issued for the other two channels if
15 # replication is stopped or upon a CHANGE MASTER command in case of open
16 # temporary tables in the corresponding channel.
17 #
18 #
19 # ==== References ====
20 #
21 # Bug#21357008: REPLICA_OPEN_TEMP_TABLES WRONG AFTER RESET SLAVE WHEN
22 # USING MULTI-SOURCE
23
24
25 --source include/have_binlog_format_statement.inc
26 # Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
27 --source include/have_slave_repository_type_table.inc
28
29 --source include/not_have_privilege_checks_user.inc
30
31 --let $rpl_multi_source= 1
32 --let $rpl_topology= 1->2, 3->2, 4->2
33 --source include/rpl_init.inc
34
35 # Create temporary tables on two channels.
36 --let $rpl_connection_name= server_1
37 --source include/rpl_connection.inc
38 CREATE TEMPORARY TABLE t1 (a INT);
39 --let $rpl_channel_name= 'channel_1'
40 --let $sync_slave_connection= server_2
41 --source include/sync_slave_sql_with_master.inc
42
43 --let $rpl_connection_name= server_3
44 --source include/rpl_connection.inc
45 CREATE TEMPORARY TABLE t3 (a INT);
46 --let $rpl_channel_name= 'channel_3'
47 --let $sync_slave_connection= server_2
48 --source include/sync_slave_sql_with_master.inc
49
50 # Only one warning should be issued when stopping all channels
51 --let $rpl_channel_name=
52 --echo Stopping slave on all channels
53 --source include/stop_slave.inc
54 --source include/start_slave.inc
55
56 --let $rpl_channel_name= 'channel_4'
57 # No warning is issued as there is no temp table open in this channel
58 --echo Stopping slave on channel_4 only
59 --source include/stop_slave.inc
60
61 --let $status= SHOW STATUS LIKE 'Replica_open_temp_tables'
62 --let $num_open_tables= query_get_value($status, Value, 1)
63 --let $correct_num_open_tables= 2
64 --let $assert_cond= $correct_num_open_tables = $num_open_tables
65 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after creating temp tables
66 --source include/assert.inc
67
68 # Stopping the replication thread does not delete tables and does not
69 # affect the status variable. It also generates a warning because there
70 # are open temporary tables in that channel.
71 --echo Stopping slave on channel_1 only
72 --let $rpl_channel_name= 'channel_1'
73 --source include/stop_slave.inc
74 --let $num_open_tables= query_get_value($status, Value, 1)
75 --let $assert_cond= $correct_num_open_tables = $num_open_tables
76 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after stopping replication thread
77 --source include/assert.inc
78
79 # Resetting slave for channel_1 causes t1 to be dropped
80 RESET SLAVE FOR CHANNEL 'channel_1';
81 --let $num_open_tables= query_get_value($status, Value, 1)
82 --let $correct_num_open_tables= 1
83 --let $assert_cond= $correct_num_open_tables = $num_open_tables
84 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after resetting channel
85 --source include/assert.inc
86
87 # STOP SLAVE generates a warning because there are open temp tables in the channel.
88 --echo Stopping slave on channel_3 only
89 --let $rpl_channel_name= 'channel_3'
90 --source include/stop_slave.inc
91
92 # CHANGE MASTER TO generates a warning because there are open temp tables in the channel.
93 --disable_query_log
94 eval CHANGE REPLICATION SOURCE TO SOURCE_PORT = $SERVER_MYPORT_3 FOR CHANNEL 'channel_3';
95 --enable_query_log
96
97 # Dropping the table that is still open will decrease the value to zero.
98 --let $rpl_channel_name= 'channel_3'
99 --source include/start_slave.inc
100 --let $rpl_connection_name= server_3
101 --source include/rpl_connection.inc
102 DROP TEMPORARY TABLE t3;
103 --let $rpl_channel_name= 'channel_3'
104 --let $sync_slave_connection= server_2
105 --source include/sync_slave_sql_with_master.inc
106 --let $num_open_tables= query_get_value($status, Value, 1)
107 --let $correct_num_open_tables= 0
108 --let $assert_cond= $correct_num_open_tables = $num_open_tables
109 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after dropping last temp table
110 --source include/assert.inc
111
112 # STOP SLAVE will not generate a warning because there are no open temp tables in the channel.
113 --echo Stopping slave on channel_3 only
114 --let $rpl_channel_name= 'channel_3'
115 --source include/stop_slave.inc
116
117 # CHANGE MASTER TO will not generate a warning because there are no open temp tables in
118 # the channel.
119 CHANGE REPLICATION SOURCE TO SOURCE_PORT = 4711 FOR CHANNEL 'channel_3';
120
121 RESET SLAVE ALL;
122 --let $rpl_skip_sync= 1
123 --let $rpl_skip_delete_channels= 1
124 --let $rpl_only_running_threads= 1
125 --let $rpl_group_replication= 1
126 --source include/rpl_end.inc