• Konstantin Osipov's avatar
    A patch and a test case for · f130de4f
    Konstantin Osipov authored
    Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT FOR UPDATE.
    
    If a transaction was rolled back inside InnoDB due to a deadlock
    or lock wait timeout, and the statement had IGNORE clause,
    the server could crash at the end of the statement or on shutdown.
    
    This was caused by the error handling infrastructure's attempt to 
    ignore a non-ignorable error.
    
    When a transaction rollback request is raised, switch off 
    current_select->no_error flag, so that the following error
    won't be ignored.
    
    Instead, we could add !thd->is_fatal_sub_stmt_error to
    my_message_sql(), but since in write_record() we switch
    off no_error, the same approach is used in 
    thd_mark_transaction_to_rollback().
    
    @todo: call thd_mark_transaction_to_rollback() from 
    handler::print_error(), then we can easily make sure
    that the error reported by print_error is not ignored.
    
    mysql-test/r/innodb_lock_wait_timeout_1.result:
      Update results (Bug#46539).
    mysql-test/t/innodb_lock_wait_timeout_1.test:
      Add a test case for Bug#46539
    sql/sql_class.cc:
      When a transaction rollback request is raised, switch of 
      current_select->no_error flag, so that the following error
      won't be ignored.
    f130de4f
sql_class.cc 109 KB