• gopal.shankar@oracle.com's avatar
    Bug#11815557 60269: MYSQL SHOULD REJECT ATTEMPTS TO CREATE SYSTEM · 796fad14
    gopal.shankar@oracle.com authored
                        TABLES IN INCORRECT ENGINE
    
    PROBLEM:
      CREATE/ALTER TABLE currently can move system tables like
    mysql.db, user, host etc, to engines other than MyISAM. This is not
    completely supported as of now, by mysqld. When some of system tables
    like plugin, servers, event, func, *_priv, time_zone* are moved
    to innodb, mysqld restart crashes. Currently system tables
    can be moved to BLACKHOLE also!!!.
    
    ANALYSIS:
      The problem is that there is no check before creating or moving
    a system table to some particular engine.
    
      System tables are suppose to be residing in MyISAM. We can think
    of restricting system tables to exist only in MyISAM. But, there could
    be future needs of these system tables to be part of other engines
    by design. For eg, NDB cluster expects some tables to be on innodb
    or ndb engine. This calls for a solution, by which system
    tables can be supported by any desired engine, with minimal effort.
    
    FIX:
      The solution provides a handlerton interface using which,
    mysqld server can query particular storage engine handlerton for
    system tables that it supports. This way each storage engine
    layer can define their own system database and system tables.
    
      The check_engine() function uses the new handlerton function
    ha_check_if_supported_system_table() to check if db.tablename
    provided in the DDL is supported by the SE.
    
    Note: This fix has modified a test in help.test, which was moving
    mysql.help_* to innodb. The primary intention of the test was not
    to move them between engines.
    796fad14
sql_table.cc 237 KB