Commit 47429054 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-22465: DROP indexed COLUMN is wrongly claimed to be ALGORITHM=INSTANT

ha_innobase::check_if_supported_inplace_alter(): Do not allow
ALGORITHM=INSTANT for operations that avoid a table rebuild
but involve dropping (or creating) secondary indexes.
parent 69925c0d
......@@ -318,8 +318,8 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-205
+207
-206
+208
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
#
......@@ -2812,11 +2812,19 @@ CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMI
ALTER TABLE t1 MODIFY b INT FIRST;
DROP TABLE t1;
disconnect analyze;
#
# MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT
#
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY
ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY;
DROP TABLE t1;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
205
206
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
#
......
......@@ -877,6 +877,17 @@ dec $format;
let $redundant_4k= 0;
}
disconnect analyze;
--echo #
--echo # MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT
--echo #
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY;
DROP TABLE t1;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
......
......@@ -2474,7 +2474,8 @@ ha_innobase::check_if_supported_inplace_alter(
}
}
if (supports_instant) {
if (supports_instant && !(ha_alter_info->handler_flags
& INNOBASE_ALTER_NOREBUILD)) {
DBUG_RETURN(HA_ALTER_INPLACE_INSTANT);
}
......@@ -2584,7 +2585,7 @@ ha_innobase::check_if_supported_inplace_alter(
online = false;
}
if (need_rebuild || fts_need_rebuild) {
if ((need_rebuild && !supports_instant) || fts_need_rebuild) {
ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
DBUG_RETURN(online
? HA_ALTER_INPLACE_COPY_NO_LOCK
......
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