• istruewing@stella.local's avatar
    Bug#31692 - binlog_killed.test crashes sometimes · 672290b0
    istruewing@stella.local authored
    The server crashed when a thread was killed while locking the
    general_log table at statement begin.
    
    The general_log table is handled like a performance schema table.
    The state of open tables is saved and cleared so that this table
    seems to be the only open one. Then this table is opened and locked.
    After writing, the table is closed and the open table state is
    restored. Before restoring, however, it is asserted that there is
    no current table open.
    
    After locking the table, mysql_lock_tables() checks if the thread
    was killed in between. If so, it unlocks the table and returns an
    error. open_ltable() just returns with the error and leaves closing
    of the table to close_thread_tables(), which is called at
    statement end.
    
    open_performance_schema_table() did not take this into account.
    It assumed that a failed open_ltable() would not leave an open
    table behind.
    
    Fixed by closing thread tables after open_ltable() and before
    restore_backup_open_tables_state() if the thread was killed.
    
    No test case. It requires correctly timed parallel execution.
    Since this bug was detected by the test suite, it seems
    dispensable to add another test.
    672290b0
sql_base.cc 241 KB