diff options
author | unknown <gopal.shankar@oracle.com> | 2012-04-11 15:53:17 +0530 |
---|---|---|
committer | unknown <gopal.shankar@oracle.com> | 2012-04-11 15:53:17 +0530 |
commit | 99b18a036cfb6d990e2f26bb43774735e2a9c7ab (patch) | |
tree | 5351d27e52955b31c1d107afd9480b37224c2b8d /mysql-test/t/alter_table.test | |
parent | 26713f5a154e1f43ac4154b643ce5090a29b35b1 (diff) | |
download | mariadb-git-99b18a036cfb6d990e2f26bb43774735e2a9c7ab.tar.gz |
Bug#11815557 60269: MYSQL SHOULD REJECT ATTEMPTS TO CREATE SYSTEM
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.
Diffstat (limited to 'mysql-test/t/alter_table.test')
-rw-r--r-- | mysql-test/t/alter_table.test | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 5cdd00b6afc..f5d5538c217 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1203,3 +1203,61 @@ rename table t2 to t1; execute stmt1; deallocate prepare stmt1; drop table t2; + +--echo # +--echo # Bug#11815557 60269: MYSQL SHOULD REJECT ATTEMPTS TO CREATE SYSTEM +--echo # TABLES IN INCORRECT ENGINE +--echo # +--echo # Note: This test assumes that only MyISAM supports system tables. +--echo # If other engines are made to support system tables, +--echo # then this test needs to be updated +--echo # + +use mysql; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE db ENGINE=innodb; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE user ENGINE=memory; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE proc ENGINE=heap; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE func ENGINE=csv; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE event ENGINE=merge; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE servers ENGINE=innodb; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE procs_priv ENGINE=memory; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE tables_priv ENGINE=heap; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE columns_priv ENGINE=csv; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE time_zone ENGINE=merge; +--error ER_UNSUPPORTED_ENGINE +ALTER TABLE help_topic ENGINE=innodb; + +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE db (dummy int) ENGINE=innodb; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE user (dummy int) ENGINE=memory; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE proc (dummy int) ENGINE=heap; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE func (dummy int) ENGINE=csv; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE event (dummy int) ENGINE=merge; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE servers (dummy int) ENGINE=innodb; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE procs_priv (dummy int) ENGINE=memory; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE tables_priv (dummy int) ENGINE=heap; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE columns_priv (dummy int) ENGINE=csv; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE time_zone (dummy int) ENGINE=merge; +--error ER_UNSUPPORTED_ENGINE +CREATE TABLE help_topic (dummy int) ENGINE=innodb; +use test; +--echo # End of Bug#11815557 |