Debian Codegraph @

mysql-test/suite/rpl/t/rpl_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.
7 #
8 # ==== Implementation ====
9 # A temporary table is first created. The slave replication thread is
10 # stopped so that the corresponding warning is generated. Finally, the
11 # temporary table is dropped to verify that the number of open tables
12 # decreased to zero and, consequently, that no warning is issued when
13 # stopping the slave's replication thread again.
14 #
15 #
16 # ==== References ====
17 #
18 # Bug#21357008: REPLICA_OPEN_TEMP_TABLES WRONG AFTER RESET SLAVE WHEN
19 # USING MULTI-SOURCE
20
21
22
23 --source include/have_binlog_format_statement.inc
24 --source include/master-slave.inc
25
26 # Create temporary table.
27 CREATE TEMPORARY TABLE t1 (a INT);
28 --source include/sync_slave_sql_with_master.inc
29
30 --let $status= SHOW STATUS LIKE 'Replica_open_temp_tables'
31 --let $num_open_tables= query_get_value($status, Value, 1)
32 --let $correct_num_open_tables= 1
33 --let $assert_cond= $correct_num_open_tables = $num_open_tables
34 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after creating a temp table
35 --source include/assert.inc
36
37 # Stopping the replication thread does not delete tables and does not
38 # affect the status variable. It also generates a warning because there
39 # are open temporary tables in the slave.
40 --source include/stop_slave.inc
41 --let $num_open_tables= query_get_value($status, Value, 1)
42 --let $assert_cond= $correct_num_open_tables = $num_open_tables
43 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after stopping the replication thread
44 --source include/assert.inc
45
46 # Dropping the table that is still open will decrease the value to zero.
47 --source include/start_slave.inc
48 --source include/rpl_connection_master.inc
49 DROP TEMPORARY TABLE t1;
50 --source include/sync_slave_sql_with_master.inc
51 --let $num_open_tables= query_get_value($status, Value, 1)
52 --let $correct_num_open_tables= 0
53 --let $assert_cond= $correct_num_open_tables = $num_open_tables
54 --let $assert_text= Replica_open_temp_tables is correctly set to $correct_num_open_tables after dropping the temporary table
55 --source include/assert.inc
56
57 # Stopping the slave will not generate a warning because there are no open tables.
58 --source include/stop_slave.inc
59 --let $rpl_only_running_threads= 1
60 --source include/rpl_end.inc