Commit 56f64f79 authored by Sergei Golubchik's avatar Sergei Golubchik

TokuDB: enable online alter for partitioned tabled

parent fca2b1a7
...@@ -219,6 +219,9 @@ static bool change_type_is_supported(TABLE *table, TABLE *altered_table, Alter_i ...@@ -219,6 +219,9 @@ static bool change_type_is_supported(TABLE *table, TABLE *altered_table, Alter_i
static ulong fix_handler_flags(THD *thd, TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alter_info) { static ulong fix_handler_flags(THD *thd, TABLE *table, TABLE *altered_table, Alter_inplace_info *ha_alter_info) {
ulong handler_flags = ha_alter_info->handler_flags; ulong handler_flags = ha_alter_info->handler_flags;
// This is automatically supported, hide the flag from later checks
handler_flags &= ~Alter_inplace_info::ALTER_PARTITIONED;
// workaround for fill_alter_inplace_info bug (#5193) // workaround for fill_alter_inplace_info bug (#5193)
// the function erroneously sets the ADD_INDEX and DROP_INDEX flags for a column addition that does not // the function erroneously sets the ADD_INDEX and DROP_INDEX flags for a column addition that does not
// change the keys. the following code turns the ADD_INDEX and DROP_INDEX flags so that we can do hot // change the keys. the following code turns the ADD_INDEX and DROP_INDEX flags so that we can do hot
...@@ -728,7 +731,8 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i ...@@ -728,7 +731,8 @@ bool ha_tokudb::commit_inplace_alter_table(TABLE *altered_table, Alter_inplace_i
if (commit) { if (commit) {
#if (50613 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \ #if (50613 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50699) || \
(50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) (50700 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 50799) || \
(100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100099)
if (ha_alter_info->group_commit_ctx) { if (ha_alter_info->group_commit_ctx) {
ha_alter_info->group_commit_ctx = NULL; ha_alter_info->group_commit_ctx = NULL;
} }
......
...@@ -13,13 +13,13 @@ foo CREATE TABLE `foo` ( ...@@ -13,13 +13,13 @@ foo CREATE TABLE `foo` (
/*!50100 PARTITION BY HASH (a) /*!50100 PARTITION BY HASH (a)
PARTITIONS 2 */ PARTITIONS 2 */
ALTER TABLE foo ADD KEY(b); ALTER TABLE foo ADD KEY(b);
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MariaDB version
SHOW CREATE TABLE foo; SHOW CREATE TABLE foo;
Table Create Table Table Create Table
foo CREATE TABLE `foo` ( foo CREATE TABLE `foo` (
`a` int(11) NOT NULL DEFAULT '0', `a` int(11) NOT NULL DEFAULT '0',
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`),
KEY `b` (`b`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1 `compression`='tokudb_zlib' ) ENGINE=TokuDB DEFAULT CHARSET=latin1 `compression`='tokudb_zlib'
/*!50100 PARTITION BY HASH (a) /*!50100 PARTITION BY HASH (a)
PARTITIONS 2 */ PARTITIONS 2 */
......
...@@ -12,12 +12,12 @@ foo CREATE TABLE `foo` ( ...@@ -12,12 +12,12 @@ foo CREATE TABLE `foo` (
/*!50100 PARTITION BY HASH (a) /*!50100 PARTITION BY HASH (a)
PARTITIONS 2 */ PARTITIONS 2 */
ALTER TABLE foo ADD COLUMN c INT; ALTER TABLE foo ADD COLUMN c INT;
ERROR 42000: Table 'foo' uses an extension that doesn't exist in this MariaDB version
SHOW CREATE TABLE foo; SHOW CREATE TABLE foo;
Table Create Table Table Create Table
foo CREATE TABLE `foo` ( foo CREATE TABLE `foo` (
`a` int(11) NOT NULL DEFAULT '0', `a` int(11) NOT NULL DEFAULT '0',
`b` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1 `compression`='tokudb_zlib' ) ENGINE=TokuDB DEFAULT CHARSET=latin1 `compression`='tokudb_zlib'
/*!50100 PARTITION BY HASH (a) /*!50100 PARTITION BY HASH (a)
......
...@@ -8,7 +8,6 @@ SET SESSION tokudb_disable_slow_alter=1; ...@@ -8,7 +8,6 @@ SET SESSION tokudb_disable_slow_alter=1;
CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS 2; CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS 2;
INSERT INTO foo VALUES (1,0),(2,0); INSERT INTO foo VALUES (1,0),(2,0);
SHOW CREATE TABLE foo; SHOW CREATE TABLE foo;
--error 1112
ALTER TABLE foo ADD KEY(b); ALTER TABLE foo ADD KEY(b);
SHOW CREATE TABLE foo; SHOW CREATE TABLE foo;
......
...@@ -7,7 +7,6 @@ DROP TABLE IF EXISTS foo; ...@@ -7,7 +7,6 @@ DROP TABLE IF EXISTS foo;
SET SESSION tokudb_disable_slow_alter=1; SET SESSION tokudb_disable_slow_alter=1;
CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS 2; CREATE TABLE foo (a INT, b INT, PRIMARY KEY (a)) PARTITION BY HASH(a) PARTITIONS 2;
SHOW CREATE TABLE foo; SHOW CREATE TABLE foo;
--error 1112
ALTER TABLE foo ADD COLUMN c INT; ALTER TABLE foo ADD COLUMN c INT;
SHOW CREATE TABLE foo; SHOW CREATE TABLE foo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment