Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.4.1, 10.5.0
Description
The following SQL test case works on 10.3 but fails to return an error on 10.4:
--source include/have_innodb.inc
|
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; |
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; |
DROP TABLE t1; |
The reason appears to be a code change that was part of MDEV-15563:
@@ -2003,9 +2040,7 @@ ha_innobase::check_if_supported_inplace_alter(
|
af++;
|
}
|
|
- if (supports_instant
|
- || !(ha_alter_info->handler_flags
|
- & ~(INNOBASE_ALTER_INSTANT | INNOBASE_INPLACE_IGNORE))) {
|
+ if (supports_instant) {
|
DBUG_RETURN(HA_ALTER_INPLACE_INSTANT);
|
}
|
|
We should not return HA_ALTER_INPLACE_INSTANT if any flags in INNOBASE_ALTER_NOREBUILD (dropping or creating secondary indexes) are set, because those are not instantaneous operations.
Attachments
Issue Links
- is caused by
-
MDEV-15563 Instant failure-free data type conversions
-
- Closed
-
- relates to
-
MDEV-21832 FORCE all partition to rebuild if any one of the partition does rebuild
-
- Closed
-
The following fix seems to work:
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 64607293ed9..ae1b6073b3a 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -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);
}
@@ -2585,7 +2586,9 @@ ha_innobase::check_if_supported_inplace_alter(
}
if (need_rebuild || fts_need_rebuild) {
- ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
+ if (!supports_instant) {
+ ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
+ }
DBUG_RETURN(online
? HA_ALTER_INPLACE_COPY_NO_LOCK
The second part is refining
MDEV-21832. Without that change, we would unnecessarily force a table to be rebuilt when dropping an indexed column.