Comment 30 for bug 758788

Revision history for this message
George Ormond Lorch III (gl-az) wrote :

OK, in sql_base.cc there is a list of TABLE* unused_tables. This is a list of tables that are currently not being used by an executing statement. Once the statement execution is complete, regardless of the overall transaction state, any tables used by that statement are placed back into this unused tables list. This list is what the FLUSH TABLES statement uses as a source of tables that it needs to flush. This translates directly into a handler::close call on the table even if the table is still included within an active transaction. So by the end of the INSERT...test.t1 statement above, mysql has determined/placed test.t1 into the unused list, thus thinking it is OK to flush that table. The FLUSH TABLES comes along then, walks the unused_tables list and closes all the tables within that list, causing XtraDB to close the dict_table within its cache, causing the dangling references within the transaction lock lists.