• Luis Soares's avatar
    BUG#55387: binlog.binlog_tmp_table crashes the server · 2773385d
    Luis Soares authored
               sporadically
    
    There are two problems:
    
    1. When closing temporary tables, during the THD clean up - and
       after the session connection was already closed, there is a
       chance we can push an error into the THD diagnostics area, if
       the writing of the implicit DROP event to the binary log fails
       for some reason. As a consequence an assertion can be
       triggered, because at that point the diagnostics area is
       already set.
    
    2. Using push_warning with MYSQL_ERROR::WARN_LEVEL_ERROR is a 
       bug.
    
    Given that close_temporary_tables is mostly called from
    THD::cleanup - ie, with the session already closed, we fix
    problem #1 by allowing the diagnostics area to be
    overwritten. There is one other place in the code that calls
    close_temporary_tables - while applying Start_log_event_v3. To
    cover that case, we make close_temporary_tables to return the
    error, thus, propagating upwards in the stack.
    
    To fix problem #2, we replace push_warning with sql_print_error.
    2773385d
sql_base.cc 299 KB