• Annamalai Gurusami's avatar
    Bug #14669848 CRASH DURING ALTER MAKES ORIGINAL TABLE INACCESSIBLE · 2ad007df
    Annamalai Gurusami authored
    When a new primary key is added to an InnoDB table, then the following
    steps are taken by InnoDB plugin:
    
    .  let t1 be the original table.
    .  a temporary table t1@00231 will be created by cloning t1.
    .  all data will be copied from t1 to t1@00231.
    .  rename t1 to t1@00232.
    .  rename t1@00231 to t1.
    .  drop t1@00232.
    
    The rename and drop operations involve file operations.  But file operations
    cannot be rolled back.  So in row_merge_rename_tables(), just after doing data
    dictionary update and before doing any file operations, generate redo logs
    for file operations and commit the transaction.  This will ensure that any
    crash after this commit, the table is still recoverable by moving .ibd and
    .frm files.  Manual recovery is required.
    
    During recovery, the rename file operation redo logs are processed.
    Previously this was being ignored.
    
    rb://1460 approved by Marko Makela.
    2ad007df
row0merge.c 70.6 KB