Current Path : /usr/opt/mysql57/mysql-test/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/opt/mysql57/mysql-test/t/partition_plugin.test |
--source include/have_innodb.inc # # Check if partitioning is already active # if (`SELECT COUNT(*) != 0 FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'partition' AND plugin_status = 'ACTIVE'`) { --skip The generic partitioning engine is already active! } # # Check if server has support for loading plugins # if (`SELECT @@have_dynamic_loading != 'YES'`) { --skip plugin requires dynamic loading } # # Check if the variable PARTITION_PLUGIN is set # if (!$PARTITION_PLUGIN) { --skip Could not find library for partition plugin, see the file plugin.defs } # # Check if --plugin-dir was setup for partition. # if (`SELECT CONCAT('--plugin-dir=', REPLACE(@@plugin_dir, '\\\\', '/')) != '$PARTITION_PLUGIN_OPT/'`) { --skip Partition plugin requires that --plugin-dir is set to the partition plugin dir } # Save the initial number of concurrent sessions --source include/count_sessions.inc let $have_innodb_native_partitioning= 1; if ($have_innodb_native_partitioning) { --echo # InnoDB supports native partitioning and is required by the test. CREATE TABLE t1 (a int) ENGINE = InnoDB PARTITION BY HASH (a) PARTITIONS 2; INSERT INTO t1 VALUES (1); SELECT * FROM t1; SHOW CREATE TABLE t1; DROP TABLE t1; } --echo # MyISAM requires ha_partition to support partitioning. --error ER_FEATURE_NOT_AVAILABLE CREATE TABLE t1 (a int) ENGINE = MyISAM PARTITION BY HASH (a) PARTITIONS 2; --replace_regex /\.dll/.so/ eval INSTALL PLUGIN `partition` SONAME '$PARTITION_PLUGIN'; --replace_regex /\.dll/.so/ SELECT PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_LIBRARY, PLUGIN_AUTHOR, PLUGIN_DESCRIPTION, PLUGIN_LICENSE, LOAD_OPTION FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'PARTITION'; --replace_regex /\.dll/.so/ --error ER_UDF_EXISTS eval INSTALL PLUGIN `PARTITION` SONAME '$PARTITION_PLUGIN'; CREATE TABLE t1 (a int) ENGINE = MyISAM PARTITION BY HASH (a) PARTITIONS 2; INSERT INTO t1 VALUES (1), (2), (3), (4), (5); --echo # UNINSTALL will give a warning since an open table is in the table cache UNINSTALL PLUGIN `partition`; --echo # Still working due to UNINSTALL not yet completed SHOW CREATE TABLE t1; SELECT COUNT(*) FROM t1; SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'PARTITION'; SELECT COUNT(*) FROM mysql.plugin; --echo # FLUSH TABLES will close all tables and allow the UNINSTALL to complete FLUSH TABLES; SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'partition'; SELECT COUNT(*) FROM mysql.plugin; --error ER_FEATURE_NOT_AVAILABLE SHOW CREATE TABLE t1; --error ER_FEATURE_NOT_AVAILABLE SELECT COUNT(*) FROM t1; --error ER_FEATURE_NOT_AVAILABLE CREATE TABLE t2 (a int) ENGINE = MyISAM PARTITION BY HASH (a) PARTITIONS 2; --error ER_STORAGE_ENGINE_NOT_LOADED DROP TABLE t1; --replace_regex /\.dll/.so/ eval INSTALL PLUGIN `PARTITION` SONAME '$PARTITION_PLUGIN'; --replace_regex /\.dll/.so/ SELECT PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_LIBRARY, PLUGIN_AUTHOR, PLUGIN_DESCRIPTION, PLUGIN_LICENSE, LOAD_OPTION FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'PARTITION'; --replace_regex /\.dll/.so/ --error ER_UDF_EXISTS eval INSTALL PLUGIN `partition` SONAME '$PARTITION_PLUGIN'; DROP TABLE t1; --echo # Simple partitioned table test CREATE TABLE t1(a int) PARTITION BY HASH (a) PARTITIONS 2; SHOW CREATE TABLE t1; INSERT INTO t1 VALUES (1), (2), (3), (4), (5); ALTER TABLE t1 ADD PARTITION PARTITIONS 1; INSERT INTO t1 VALUES (6), (7), (8); SELECT COUNT(*) FROM t1; --echo # Cannot drop a partition from a HASH partitioned table --error ER_ONLY_ON_RANGE_LIST_PARTITION ALTER TABLE t1 DROP PARTITION p0; ALTER TABLE t1 COALESCE PARTITION 2; --error ER_DROP_LAST_PARTITION ALTER TABLE t1 COALESCE PARTITION 1; SHOW CREATE TABLE t1; DROP TABLE t1; UNINSTALL PLUGIN `partition`; --error ER_SP_DOES_NOT_EXIST UNINSTALL PLUGIN `PARTITION`;