• unknown's avatar
    Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements · 838b5378
    unknown authored
    Problems (appear only under some circumstances): 
      1. we get a reference to a deleted table searching in the 
         thd->handler_tables_hash in the mysql_ha_read().
    
      2. DBUG_ASSERT(table->file->inited == handler::NONE); assert fails in the
         close_thread_table().
    
    Fix: end open index scans and table scans and remove references to the 
    tables from the handler tables hash. After this preparation it is safe 
    to close the tables. The close can no longer fail on open index/table 
    scans and the closed table will not be used again by handler functions.
                                     
    
    
    sql/mysql_priv.h:
      Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements
        - mysql_ha_mark_tables_for_reopen() introduced.
    sql/sql_base.cc:
      Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements
        - call mysql_ha_mark_tables_for_reopen() to prepare for the following close.
    sql/sql_handler.cc:
      Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements
        - mysql_ha_mark_tables_for_reopen() function introduced.
    838b5378
mysql_priv.h 64.4 KB