• Mattias Jonsson's avatar
    Bug#42438: Crash ha_partition::change_table_ptr · 54c076e9
    Mattias Jonsson authored
    There was two problems:
    The first was the symptom, caused by bad error handling in
    ha_partition. It did not handle print_error etc. when
    having no partitions (when used by dummy handler).
    
    The second was the real problem that when dropping tables
    it reused the table type (storage engine) from when the lock
    was asked for, not the table type that it had when gaining
    the exclusive name lock. So that it tried to delete tables
    from wrong storage engines.
    
    Solutions for the first problem was to accept some handler
    calls to the partitioning handler even if it was not setup
    with any partitions, and also if possible fallback
    to use the base handler's default functions.
    
    Solution for the second problem was to remove the optimization
    to reuse the definition from the cache, instead always check
    the frm-file when holding the LOCK_open mutex
    
    (updated with a fix for a debug print crash and better
    comments as required by reviewer, and removed optimization
    to avoid reading the frm-file).
    54c076e9
sql_table.cc 251 KB