1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-13847 Allow ALTER TABLE…ADD SPATIAL INDEX…ALGORITHM=INPLACE

MDEV-13851 Always check table options in ALTER TABLE…ALGORITHM=INPLACE

In the merge of MySQL 5.7.9 to MariaDB 10.2.2, some code was included
that prevents ADD SPATIAL INDEX from being executed with ALGORITHM=INPLACE.

Also, the constant ADD_SPATIAL_INDEX was introduced as an alias
to ADD_INDEX. We will remove that alias now, and properly implement
the same ADD SPATIAL INDEX restrictions as MySQL 5.7 does:

1. table-rebuilding operations are not allowed if SPATIAL INDEX survive it
2. ALTER TABLE…ADD SPATIAL INDEX…LOCK=NONE is not allowed

ha_innobase::prepare_inplace_alter_table(): If the ALTER TABLE
requires actions within InnoDB, enforce the table options (MDEV-13851).
In this way, we will keep denying ADD SPATIAL INDEX for tables
that use encryption (MDEV-11974), even if ALGORITHM=INPLACE is used.
This commit is contained in:
Marko Mäkelä
2017-09-20 16:52:11 +03:00
parent e53e58d4e4
commit 96f06f952d
9 changed files with 158 additions and 115 deletions

View File

@@ -9,10 +9,14 @@ ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong creat
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), ALGORITHM=COPY;
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), FORCE, ALGORITHM=INPLACE;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED'
ALTER TABLE t1 ADD SPATIAL INDEX(coordinate);
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED'
CREATE SPATIAL INDEX b on t1(coordinate);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate);
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED'
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=DEFAULT ENGINE=INNODB;