1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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 c755974775 (MDEV-19611).
This commit is contained in:
Marko Mäkelä
2021-08-23 09:13:55 +03:00
parent 8a33d36dac
commit 7b492d6a70
3 changed files with 25 additions and 0 deletions

View File

@ -139,3 +139,15 @@ ALTER TABLE t1 ADD f3 DATE NOT NULL, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
DROP TABLE t1;
disconnect purge_control;
#
# MDEV-26458 SIGSEGV in innobase_table_is_empty() on ALTER TABLE
#
CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB;
ALTER TABLE t DISCARD TABLESPACE;
SET sql_mode='NO_ZERO_DATE';
ALTER TABLE t ADD c DATE NOT NULL;
Warnings:
Warning 1814 Tablespace has been discarded for table `t`
SET sql_mode=DEFAULT;
DROP TABLE t;
# End of 10.3 tests