| 1 |
# |
| 2 |
# === Bug#18236612: I_S.INNODB_TEMP_TABLE_INFO AND REPLICA_OPEN_TEMP_TABLES SHOWS DIFFERENT RESULTS === |
| 3 |
# |
| 4 |
# |
| 5 |
# ==== Problem with the bug ==== |
| 6 |
# |
| 7 |
# With gtid-mode=on, STOP SLAVE followed by START SLAVE results in a mismatch |
| 8 |
# between I_S.INNODB_TEMP_TABLE_INFO AND REPLICA_OPEN_TEMP_TABLES. The innodb |
| 9 |
# table shows that no such table exists but the slave_open_temp_variable is |
| 10 |
# non-zero. This problem was not seen with gtid-mode=off |
| 11 |
# |
| 12 |
|
| 13 |
# No need to test RBR Since we dont replicate temp tables at slave with RBR |
| 14 |
--source include/have_binlog_format_statement.inc |
| 15 |
--source include/master-slave.inc |
| 16 |
|
| 17 |
CREATE TEMPORARY TABLE TEMP1 (a int); |
| 18 |
--source include/sync_slave_sql_with_master.inc |
| 19 |
|
| 20 |
--echo |
| 21 |
--echo # Verify that the innodb table and slave_open_temp_table both indicate |
| 22 |
--echo # that there is an open temp table at slave. |
| 23 |
--echo |
| 24 |
|
| 25 |
--connection slave |
| 26 |
--let $innodb_tbl_value= `SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO` |
| 27 |
--let $var_value= `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME= 'REPLICA_OPEN_TEMP_TABLES'` |
| 28 |
|
| 29 |
--let $assert_text= Both INNODB_TEMP_TABLE_INFO and REPLICA_OPEN_TEMP_TABLES should show a temp table exists. |
| 30 |
--let $assert_cond= $innodb_tbl_value = $var_value AND $innodb_tbl_value = 1 |
| 31 |
--source include/assert.inc |
| 32 |
|
| 33 |
--echo |
| 34 |
--echo # Verify that after STOP SLAVE the innodb table and slave_open_temp_table |
| 35 |
--echo # both indicate that there is an open temp table at slave. |
| 36 |
--echo |
| 37 |
|
| 38 |
--source include/stop_slave.inc |
| 39 |
--let $innodb_tbl_value= `SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO` |
| 40 |
--let $var_value= `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME= 'REPLICA_OPEN_TEMP_TABLES'` |
| 41 |
|
| 42 |
--let $assert_text= Both INNODB_TEMP_TABLE_INFO and REPLICA_OPEN_TEMP_TABLES should show a temp table exists. |
| 43 |
--let $assert_cond= $innodb_tbl_value = $var_value AND $innodb_tbl_value = 1 |
| 44 |
--source include/assert.inc |
| 45 |
|
| 46 |
--echo |
| 47 |
--echo # Verify that after CHANGE MASTER the innodb table and slave_open_temp_table |
| 48 |
--echo # both indicate that there is an open temp table at slave. |
| 49 |
--echo |
| 50 |
|
| 51 |
--replace_result $MASTER_MYPORT MASTER_PORT |
| 52 |
eval CHANGE REPLICATION SOURCE TO SOURCE_PORT= $MASTER_MYPORT; |
| 53 |
|
| 54 |
--let $innodb_tbl_value= `SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO` |
| 55 |
--let $var_value= `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME= 'REPLICA_OPEN_TEMP_TABLES'` |
| 56 |
|
| 57 |
--let $assert_text= Both INNODB_TEMP_TABLE_INFO and REPLICA_OPEN_TEMP_TABLES should show a temp table exists. |
| 58 |
--let $assert_cond= $innodb_tbl_value = $var_value AND $innodb_tbl_value = 1 |
| 59 |
--source include/assert.inc |
| 60 |
|
| 61 |
--source include/start_slave.inc |
| 62 |
|
| 63 |
--echo |
| 64 |
--echo # This is where the mismatch was found in the bug. |
| 65 |
--echo # Verify that the bug is fixed and hence we have equal values here. |
| 66 |
--echo |
| 67 |
|
| 68 |
# Apparently there is another bug here due to which temporary tables are sometimes |
| 69 |
# open and sometimes closed at this point. So we dont assert for the the number |
| 70 |
# of temp table itself. |
| 71 |
|
| 72 |
--let $innodb_tbl_value= `SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO` |
| 73 |
--let $var_value= `SELECT VARIABLE_VALUE FROM performance_schema.global_status WHERE VARIABLE_NAME= 'REPLICA_OPEN_TEMP_TABLES'` |
| 74 |
|
| 75 |
--let $assert_text= count(*) from INNODB_TEMP_TABLE_INFO and REPLICA_OPEN_TEMP_TABLES should match. |
| 76 |
--let $assert_cond= $innodb_tbl_value = $var_value |
| 77 |
--source include/assert.inc |
| 78 |
# If the temp table still exists, mtr end state check will complain of |
| 79 |
# replica_open_temp_tables= 1. |
| 80 |
--connection master |
| 81 |
DROP TEMPORARY TABLE IF EXISTS TEMP1; |
| 82 |
|
| 83 |
--source include/rpl_end.inc |