Description:
The rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch test fails frequently
for me in highly-concurrent MTR runs. The reason is that the test
asserts a condition which depends on specific timing of events.
More specifically, it asserts that after a START SLAVE the number of
temporary tables in INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO equals the
value reported by the slave_open_temp_tables system variables. Those
values, however, are never updated atomically, so race conditions are
always possible.
For example, one place where slave_open_temp_tables is updated is
sql_base.cc:close_temporary_tables(). As seen from the code, we first go
over all open temporary tables and close them (which I think will be
reflected immediately in I_S.INNODB_TEMP_TABLE_INFO), and only after
that loop slave_open_temp_tables is updated. So any test asserting the
same values shown by I_S and slave_open_temp_tables must do extra
synchronization.
How to repeat:
It may be hard to repeat under normal conditions, so the best bet here
is to look at the test case and the relevant code parts.
Suggested fix:
Use DEBUG_SYNC point(s) to make the test reliable.