• mariadb-DebarunBanerjee's avatar
    MDEV-33593 Auto increment deadlock error causes ASSERT in subsequent save point · afe96329
    mariadb-DebarunBanerjee authored
    The issue here is ha_innobase::get_auto_increment() could cause a
    deadlock involving auto-increment lock and rollback the transaction
    implicitly. For such cases, storage engines usually call
    thd_mark_transaction_to_rollback() to inform SQL engine about it which
    in turn takes appropriate actions and close the transaction. In innodb,
    we call it while converting Innodb error code to MySQL.
    
    However, since ::innobase_get_autoinc() returns void, we skip the call
    for error code conversion and also miss marking the transaction for
    rollback for deadlock error. We assert eventually while releasing a
    savepoint as the transaction state is not active.
    
    Since convert_error_code_to_mysql() is handling some generic error
    handling part, like invoking the callback when needed, we should call
    that function in ha_innobase::get_auto_increment() even if we don't
    return the resulting mysql error code back.
    afe96329
lock0lock.cc 195 KB