• unknown's avatar
    Fix for bug #28415 "Some ALTER TABLE statements no longer work under LOCK · 48b0f260
    unknown authored
    TABLES" and failures of alter_table.test on Windows which occured after
    pushing fix for bugs #20662, #20903, #24508, #24738 (various problems
    with CREATE TABLE SELECT).
    
    ALTER TABLE statements which were handled using "fast" alter table
    optimization were not properly working under LOCK TABLES if table
    was transactional (for all table types under Windows).
    
    Code implementing "fast" version of ALTER TABLE tried to open and
    lock table using open_ltable() after renaming .FRM files (which
    corresponds to renaming tables in normal case) in some cases
    (for transactional tables or on Windows). This caused problems
    under LOCK TABLES and conflicted with name-lock taken by 
    ALTER TABLE RENAME on target tables.
    
    This patch solves this issue by using reopen_name_locked_table()
    instead of open_ltable().
    
    
    mysql-test/include/mix1.inc:
      Added test for bug #28415 "Some ALTER TABLE statements no longer work
      under LOCK TABLES" and minimal coverage for fast ALTER TABLE behaviour
      for transactional tables.
    mysql-test/r/innodb_mysql.result:
      Added test for bug #28415 "Some ALTER TABLE statements no longer work
      under LOCK TABLES" and minimal coverage for fast ALTER TABLE behaviour
      for transactional tables.
    sql/sql_table.cc:
      mysql_alter_table():
        Fixed handling of transactional tables (and all tables on Windows)
        by "fast" ALTER TABLE.
        Code implementing "fast" version of ALTER TABLE tried to open and
        lock table using open_ltable() after renaming .FRM files (which
        corresponds to renaming tables in normal case) for such tables.
        This caused problems under LOCK TABLES and conflicted with name-lock
        taken by ALTER TABLE RENAME on target tables. We solve this issue by
        using reopen_name_locked_table() instead of open_ltable().
    48b0f260
mix1.inc 22.7 KB