110 lines
4.5 KiB
Plaintext
110 lines
4.5 KiB
Plaintext
# 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;
|
|
a
|
|
1
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
/*!50100 PARTITION BY HASH (a)
|
|
PARTITIONS 2 */
|
|
DROP TABLE t1;
|
|
# MyISAM requires ha_partition to support partitioning.
|
|
CREATE TABLE t1 (a int)
|
|
ENGINE = MyISAM
|
|
PARTITION BY HASH (a) PARTITIONS 2;
|
|
ERROR HY000: The 'partitioning' feature is not available; you need to remove '--skip-partition' or use MySQL built with '-DWITH_PARTITION_STORAGE_ENGINE=1'
|
|
INSTALL PLUGIN `partition` SONAME 'ha_partition.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';
|
|
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_LIBRARY PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION
|
|
partition 1.0 ACTIVE STORAGE ENGINE ha_partition.so Mikael Ronstrom, MySQL AB Partition Storage Engine Helper GPL ON
|
|
INSTALL PLUGIN `PARTITION` SONAME 'ha_partition.so';
|
|
ERROR HY000: Function 'PARTITION' already exists
|
|
CREATE TABLE t1 (a int)
|
|
ENGINE = MyISAM
|
|
PARTITION BY HASH (a) PARTITIONS 2;
|
|
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
|
|
# UNINSTALL will give a warning since an open table is in the table cache
|
|
UNINSTALL PLUGIN `partition`;
|
|
Warnings:
|
|
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
|
# Still working due to UNINSTALL not yet completed
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
/*!50100 PARTITION BY HASH (a)
|
|
PARTITIONS 2 */
|
|
SELECT COUNT(*) FROM t1;
|
|
COUNT(*)
|
|
5
|
|
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'PARTITION';
|
|
PLUGIN_NAME PLUGIN_STATUS
|
|
partition DELETED
|
|
SELECT COUNT(*) FROM mysql.plugin;
|
|
COUNT(*)
|
|
0
|
|
# FLUSH TABLES will close all tables and allow the UNINSTALL to complete
|
|
FLUSH TABLES;
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PLUGINS WHERE plugin_name = 'partition';
|
|
COUNT(*)
|
|
0
|
|
SELECT COUNT(*) FROM mysql.plugin;
|
|
COUNT(*)
|
|
0
|
|
SHOW CREATE TABLE t1;
|
|
ERROR HY000: The 'partitioning' feature is not available; you need to remove '--skip-partition' or use MySQL built with '-DWITH_PARTITION_STORAGE_ENGINE=1'
|
|
SELECT COUNT(*) FROM t1;
|
|
ERROR HY000: The 'partitioning' feature is not available; you need to remove '--skip-partition' or use MySQL built with '-DWITH_PARTITION_STORAGE_ENGINE=1'
|
|
CREATE TABLE t2 (a int)
|
|
ENGINE = MyISAM
|
|
PARTITION BY HASH (a) PARTITIONS 2;
|
|
ERROR HY000: The 'partitioning' feature is not available; you need to remove '--skip-partition' or use MySQL built with '-DWITH_PARTITION_STORAGE_ENGINE=1'
|
|
DROP TABLE t1;
|
|
ERROR HY000: Storage engine for table 'test'.'t1' is not loaded.
|
|
INSTALL PLUGIN `PARTITION` SONAME 'ha_partition.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';
|
|
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_LIBRARY PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION
|
|
partition 1.0 ACTIVE STORAGE ENGINE ha_partition.so Mikael Ronstrom, MySQL AB Partition Storage Engine Helper GPL ON
|
|
INSTALL PLUGIN `partition` SONAME 'ha_partition.so';
|
|
ERROR HY000: Function 'partition' already exists
|
|
DROP TABLE t1;
|
|
# Simple partitioned table test
|
|
CREATE TABLE t1(a int) PARTITION BY HASH (a) PARTITIONS 2;
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
/*!50100 PARTITION BY HASH (a)
|
|
PARTITIONS 2 */
|
|
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;
|
|
COUNT(*)
|
|
8
|
|
# Cannot drop a partition from a HASH partitioned table
|
|
ALTER TABLE t1 DROP PARTITION p0;
|
|
ERROR HY000: DROP PARTITION can only be used on RANGE/LIST partitions
|
|
ALTER TABLE t1 COALESCE PARTITION 2;
|
|
ALTER TABLE t1 COALESCE PARTITION 1;
|
|
ERROR HY000: Cannot remove all partitions, use DROP TABLE instead
|
|
SHOW CREATE TABLE t1;
|
|
Table Create Table
|
|
t1 CREATE TABLE `t1` (
|
|
`a` int(11) DEFAULT NULL
|
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
/*!50100 PARTITION BY HASH (a)
|
|
PARTITIONS 1 */
|
|
DROP TABLE t1;
|
|
UNINSTALL PLUGIN `partition`;
|
|
UNINSTALL PLUGIN `PARTITION`;
|
|
ERROR 42000: PLUGIN PARTITION does not exist
|