• Marko Mäkelä's avatar
    Bug #11760042 - 52409: Assertion failure: long semaphore wait · d0b1a646
    Marko Mäkelä authored
    In ha_innobase::create(), we check some things while holding an
    exclusive lock on the data dictionary. Defer the locking and the
    creation of transactions until after the checks have passed. The
    THDVAR could hang due to a mutex wait (see Bug #11750569 - 41163:
    deadlock in mysqld: LOCK_global_system_variables and LOCK_open), and
    we want to avoid waiting while holding InnoDB mutexes.
    
    innobase_index_name_is_reserved(): Replace the parameter trx_t with
    THD, so that the test can be performed before starting an InnoDB
    transaction. We only needed trx->mysql_thd.
    
    ha_innobase::create(): Create transaction and lock the data dictionary
    only after passing the basic tests.
    
    create_table_def(): Move the IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS
    check to ha_innobase::create(). Assign to srv_lower_case_table_names
    while holding dict_sys->mutex.
    
    ha_innobase::delete_table(), ha_innobase::rename_table(),
    innobase_rename_table(): Assign srv_lower_case_table_names as late as
    possible. Here, the variable is not necessarily protected by
    dict_sys->mutex.
    
    ha_innobase::add_index(): Invoke innobase_index_name_is_reserved() and
    innobase_check_index_keys() before allocating anything.
    
    rb:618 approved by Jimmy Yang
    d0b1a646
ha_innodb.cc 262 KB