• Mattias Jonsson's avatar
    Bug#56172: Server crashes in ha_partition::reset on · 2a67a3a7
    Mattias Jonsson authored
               REBUILD PARTITION under LOCK TABLE
    
    Collapsed patch including updates from the reviews.
    
    In case of failure in ALTER ... PARTITION under LOCK TABLE
    the server could crash, due to it had modified the locked
    table object, which was not reverted in case of failure,
    resulting in a bad table definition used after the failed
    command.
    
    Solved by instead of altering the locked table object and
    its partition_info struct, creating an internal temporary
    intermediate table object used for altering,
    just like the non partitioned mysql_alter_table.
    So if an error occur before the alter operation is complete,
    the original table is not modified at all.
    But if the alter operation have succeeded so far that it
    must be completed as whole,
    the table is properly closed and reopened.
    (The completion on failure is done by the ddl_log.)
    2a67a3a7
sql_partition.cc 265 KB