summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-08-23 09:13:55 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-08-23 09:13:55 +0300
commit7b492d6a70b78ad811cb5e81e1684f1b8e454690 (patch)
tree6c4386044bcbf8873fc4d1f1faa18fcb1376e436 /storage/innobase
parent8a33d36dac5330336eca0543d814fa5d97a46361 (diff)
downloadmariadb-git-7b492d6a70b78ad811cb5e81e1684f1b8e454690.tar.gz
MDEV-26458 Crash on ALTER TABLE after DISCARD TABLESPACE
ha_innobase::check_if_supported_inplace_alter(): Do not invoke innobase_table_is_empty() if the tablespace has been discarded. That is, native ALTER TABLE in InnoDB will treat an empty table in the same way as a tablespace whose tablespace has been discarded. (Note: ALTER TABLE...ALGORITHM=COPY will fail if the tablespace has been discarded.) This fixes a crash that was introduced in commit c755974775a7a7f4fc24abeacd2fc9ea7bf0c247 (MDEV-19611).
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/handler/handler0alter.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index ff7c355f2dd..8418ad7316c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1164,6 +1164,7 @@ ha_innobase::check_if_supported_inplace_alter(
/* '0000-00-00' value isn't allowed for datetime datatype
for newly added column when table is not empty */
if (ha_alter_info->error_if_not_empty
+ && m_prebuilt->table->space
&& !innobase_table_is_empty(m_prebuilt->table)) {
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}