• Nikita Malyavin's avatar
    MDEV-32100 Online ALTER TABLE ends with 1032 under some isolation levels · 46ee272a
    Nikita Malyavin authored
    1032 (Can't find record) could be emitted when ALTER TABLE is execued vs
    concurrent DELETE/UPDATE/other DML that would require search on the online
    ALTER's side.
    
    Innodb's INPLACE, in comparison, creates a new trx_t and uses it in scope
    of the alter table context.
    
    ALTER TABLE class of statements (i.g. CREATE INDEX, OPTIMIZE, etc.) is
    expected to be unaffected by the value of current session's transaction
    isolation.
    
    This patch save-and-restores thd->tx_isolation and sets in to
    ISO_REPEATABLE_READ for almost a whole mysql_alter_table duration, to avoid
    any possible side-effect of it. This should be primarily done before the
    lock_tables call, to initialize the storage engine's local value correctly
    during the store_lock() call.
    
    sql_table.cc: set thd->tx_isolation to ISO_REPEATABLE_READ in
    mysql_alter_table and then restore it to the original value in the end of
    the call.
    46ee272a
alter_table_online_debug.test 41.2 KB