• Magne Mahre's avatar
    Bug #46941 crash with lower_case_table_names=2 and foreign key · 95d91c0f
    Magne Mahre authored
               data dictionary confusion
    
    On file systems with case insensitive file names, and
    lower_case_table_names set to '2', the server could crash
    due to a table definition cache inconsistency.  This is 
    the default setting on MacOSX, but may also be set and
    used on MS Windows.
    
    The bug is caused by using two different strategies for
    creating the hash key for the table definition cache, resulting
    in failure to look up an entry which is present in the cache,
    or failure to delete an existing entry.  One strategy was to
    use the real table name (with case preserved), and the other
    to use a normalized table name (i.e a lower case version).
    
    This is manifested in two cases.  One is  during 'DROP DATABASE', 
    where all known files are removed.  The removal from
    the table definition cache is done via a generated list of
    TABLE_LIST with keys (wrongly) created using the case preserved 
    name.  The other is during CREATE TABLE, where the cache lookup
    is also (wrongly) based on the case preserved name.
       
    The fix was to use only the normalized table name when
    creating hash keys.
    
    
    sql/sql_db.cc:
      Normalize table name (i.e lower case it)
    sql/sql_table.cc:
      table_name contains the normalized name
      alias contains the real table name
    95d91c0f
lowercase_table4-master.opt 28 Bytes