Commit a8a22b7a authored by Sergei Golubchik's avatar Sergei Golubchik

support 'alter online table t1 page_checksum=0'

parent 6c57e29b
...@@ -1733,6 +1733,7 @@ affected rows: 0 ...@@ -1733,6 +1733,7 @@ affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 1 info: Records: 0 Duplicates: 0 Warnings: 1
Warnings: Warnings:
Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release Note 1831 Duplicate index `i3`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= COPY, LOCK= NONE;
ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED; ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED;
affected rows: 2 affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 1 info: Records: 2 Duplicates: 0 Warnings: 1
...@@ -1749,8 +1750,7 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED; ...@@ -1749,8 +1750,7 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE; ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
affected rows: 0 affected rows: 0
ALTER ONLINE TABLE m1 ADD COLUMN c int; ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= NONE;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED; ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED;
affected rows: 2 affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0 info: Records: 2 Duplicates: 0 Warnings: 0
......
...@@ -1517,6 +1517,13 @@ ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4; ...@@ -1517,6 +1517,13 @@ ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4;
ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= NONE; ALTER TABLE t1 ADD INDEX i1(b), ALGORITHM= INPLACE, LOCK= NONE;
ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= INPLACE, LOCK= SHARED; ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= INPLACE, LOCK= SHARED;
ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE; ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
--disable_info
--disable_warnings
--error 0,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
# COPY/NONE works now, but still an error in embedded
ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= COPY, LOCK= NONE;
--enable_warnings
--enable_info
ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED; ALTER TABLE t1 ADD INDEX i5(b), ALGORITHM= COPY, LOCK= SHARED;
ALTER TABLE t1 ADD INDEX i6(b), ALGORITHM= COPY, LOCK= EXCLUSIVE; ALTER TABLE t1 ADD INDEX i6(b), ALGORITHM= COPY, LOCK= EXCLUSIVE;
...@@ -1525,8 +1532,11 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= NONE; ...@@ -1525,8 +1532,11 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED; ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= SHARED;
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE; ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE, LOCK= EXCLUSIVE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED --disable_info
ALTER ONLINE TABLE m1 ADD COLUMN c int; --error 0,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
# COPY/NONE works now, but still an error in embedded
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= NONE;
--enable_info
# This works because the lock will be SNW for the copy phase. # This works because the lock will be SNW for the copy phase.
# It will still require exclusive lock for actually enabling keys. # It will still require exclusive lock for actually enabling keys.
ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED; ALTER TABLE m1 ENABLE KEYS, ALGORITHM= COPY, LOCK= SHARED;
......
...@@ -53,30 +53,11 @@ t1 CREATE TABLE `t1` ( ...@@ -53,30 +53,11 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='new comment' ) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 COMMENT='new comment'
alter online table t1 page_checksum=1; alter online table t1 page_checksum=1;
alter online table t1 page_checksum=0;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
drop table t1; drop table t1;
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')); create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3); insert into t1 (a) values (1),(2),(3);
alter online table t1 drop column b, add b int;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify b bigint;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify e enum('c','a','b');
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify c varchar(50);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 modify c varchar(100);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 add f int;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 engine=memory;
alter online table t1 rename to t2; alter online table t1 rename to t2;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE
alter online table t1 checksum=1;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter online table t1 add constraint check (b > 0);
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED
alter table t1 engine=innodb; alter table t1 engine=innodb;
alter table t1 add index (b); alter table t1 add index (b);
alter online table t1 add index c (c); alter online table t1 add index c (c);
......
...@@ -33,7 +33,6 @@ drop table t1; ...@@ -33,7 +33,6 @@ drop table t1;
# #
create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')); create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3); insert into t1 (a) values (1),(2),(3);
alter online table t1 modify b int default 5, alter c set default 'X'; alter online table t1 modify b int default 5, alter c set default 'X';
alter online table t1 change b new_name int; alter online table t1 change b new_name int;
alter online table t1 modify e enum('a','b','c'); alter online table t1 modify e enum('a','b','c');
...@@ -54,37 +53,13 @@ alter online table t1 modify e enum('a','b','c'); ...@@ -54,37 +53,13 @@ alter online table t1 modify e enum('a','b','c');
alter online table t1 comment "new comment"; alter online table t1 comment "new comment";
show create table t1; show create table t1;
alter online table t1 page_checksum=1; alter online table t1 page_checksum=1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 page_checksum=0;
drop table t1; drop table t1;
#
# Test of things that is not possible to do online
#
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')); create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
insert into t1 (a) values (1),(2),(3); insert into t1 (a) values (1),(2),(3);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 drop column b, add b int;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 modify b bigint;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 modify e enum('c','a','b');
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 modify c varchar(50);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 modify c varchar(100);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 add f int;
--error 0,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter online table t1 engine=memory;
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 rename to t2; alter online table t1 rename to t2;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 checksum=1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 add constraint check (b > 0);
alter table t1 engine=innodb; alter table t1 engine=innodb;
alter table t1 add index (b); alter table t1 add index (b);
......
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=aria;
insert into t1 (a) values (1),(2),(3);
alter online table t1 page_checksum=1;
alter online table t1 page_checksum=0;
alter online table t1 drop column b, add b int;
alter online table t1 modify b bigint;
alter online table t1 modify e enum('c','a','b');
alter online table t1 modify c varchar(50);
alter online table t1 modify c varchar(100);
alter online table t1 add f int;
alter online table t1 engine=memory;
alter online table t1 checksum=1;
alter online table t1 add constraint check (b > 0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
`c` varchar(100) DEFAULT NULL,
`e` enum('c','a','b') DEFAULT NULL,
`b` bigint(20) DEFAULT NULL,
`f` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
CONSTRAINT `CONSTRAINT_1` CHECK (`b` > 0)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci CHECKSUM=1
drop table t1;
source include/not_embedded.inc;
#
# Test of ALTER ONLINE TABLE syntax
# (same as LOCK=NONE)
#
create table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b')) engine=aria;
insert into t1 (a) values (1),(2),(3);
alter online table t1 page_checksum=1;
alter online table t1 page_checksum=0;
alter online table t1 drop column b, add b int;
alter online table t1 modify b bigint;
alter online table t1 modify e enum('c','a','b');
alter online table t1 modify c varchar(50);
alter online table t1 modify c varchar(100);
alter online table t1 add f int;
alter online table t1 engine=memory;
alter online table t1 checksum=1;
alter online table t1 add constraint check (b > 0);
show create table t1;
drop table t1;
...@@ -872,6 +872,7 @@ CREATE TABLE t1(a INT); ...@@ -872,6 +872,7 @@ CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(2147483647); INSERT INTO t1 VALUES(2147483647);
ALTER TABLE t1 ADD COLUMN h INT AS (a) VIRTUAL; ALTER TABLE t1 ADD COLUMN h INT AS (a) VIRTUAL;
ALTER TABLE t1 CHANGE h i INT AS (a) VIRTUAL, ALGORITHM=COPY; ALTER TABLE t1 CHANGE h i INT AS (a) VIRTUAL, ALGORITHM=COPY;
# COPY/NONE is not supported in embedded
--error ER_WARN_DATA_OUT_OF_RANGE,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_WARN_DATA_OUT_OF_RANGE,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE; ALTER TABLE t1 ADD COLUMN b SMALLINT AS (a) VIRTUAL, ALGORITHM=COPY, LOCK=NONE;
--error ER_WARN_DATA_OUT_OF_RANGE,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_WARN_DATA_OUT_OF_RANGE,ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
......
...@@ -957,12 +957,12 @@ CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); ...@@ -957,12 +957,12 @@ CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
INSERT INTO t1 VALUES (11, 3, DEFAULT, 'mm'); INSERT INTO t1 VALUES (11, 3, DEFAULT, 'mm');
INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm'); INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm'); INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm');
ALTER TABLE t1 ADD INDEX idx12 (c) , FORCE, LOCK=NONE; ALTER TABLE t1 ADD INDEX idx12 (c), FORCE, ALGORITHM = INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 ADD INDEX idx12 (c), LOCK=NONE; ALTER TABLE t1 ADD INDEX idx12 (c), LOCK=NONE;
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c) , FORCE, LOCK=NONE; ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), FORCE, ALGORITHM = INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), LOCK=NONE; ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), ALGORITHM = INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
DROP TABLE t1 ; DROP TABLE t1 ;
CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT GENERATED ALWAYS AS(a+b), h VARCHAR(10)); CREATE TABLE t1 (a INT, b INT, c INT GENERATED ALWAYS AS(a+b), d INT GENERATED ALWAYS AS(a+b), h VARCHAR(10));
......
...@@ -53,7 +53,7 @@ a b c h ...@@ -53,7 +53,7 @@ a b c h
18 1 19 mm 18 1 19 mm
28 1 29 mm 28 1 29 mm
NULL NULL NULL mx NULL NULL NULL mx
ALTER TABLE t FORCE, LOCK=NONE; ALTER TABLE t FORCE, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
disconnect con1; disconnect con1;
DROP TABLE t; DROP TABLE t;
......
...@@ -6,30 +6,30 @@ CREATE TABLE t4 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB ...@@ -6,30 +6,30 @@ CREATE TABLE t4 (i INT, v INT AS (i) VIRTUAL) ENGINE=InnoDB
ROW_FORMAT=REDUNDANT; ROW_FORMAT=REDUNDANT;
INSERT INTO t4 SET i=1; INSERT INTO t4 SET i=1;
ALTER TABLE t4 ADD INDEX(v), LOCK=NONE; ALTER TABLE t4 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t4 ADD COLUMN k INT, LOCK=NONE; ALTER TABLE t4 ADD COLUMN k INT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t4 DROP k, LOCK=NONE; ALTER TABLE t4 DROP k, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t4 DROP INDEX v, LOCK=NONE; ALTER TABLE t4 DROP INDEX v, LOCK=NONE;
INSERT INTO t3 SET i=1; INSERT INTO t3 SET i=1;
ALTER TABLE t3 ADD INDEX(v), LOCK=NONE; ALTER TABLE t3 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t3 ADD COLUMN k INT, LOCK=NONE; ALTER TABLE t3 ADD COLUMN k INT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t3 DROP k, LOCK=NONE; ALTER TABLE t3 DROP k, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t3 DROP INDEX v, LOCK=NONE; ALTER TABLE t3 DROP INDEX v, LOCK=NONE;
INSERT INTO t2 SET i=1; INSERT INTO t2 SET i=1;
ALTER TABLE t2 ADD INDEX(v), LOCK=NONE; ALTER TABLE t2 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t2 ADD COLUMN k INT, LOCK=NONE; ALTER TABLE t2 ADD COLUMN k INT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t2 DROP k, LOCK=NONE; ALTER TABLE t2 DROP k, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t2 DROP INDEX v, LOCK=NONE; ALTER TABLE t2 DROP INDEX v, LOCK=NONE;
INSERT INTO t1 SET i=1; INSERT INTO t1 SET i=1;
ALTER TABLE t1 ADD INDEX(v), LOCK=NONE; ALTER TABLE t1 ADD INDEX(v), LOCK=NONE;
ALTER TABLE t1 ADD COLUMN k INT, LOCK=NONE; ALTER TABLE t1 ADD COLUMN k INT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: online rebuild with indexed virtual columns. Try LOCK=SHARED
ALTER TABLE t1 DROP k, LOCK=NONE; ALTER TABLE t1 DROP k, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 42000: Can't DROP COLUMN `k`; check that it exists ERROR 42000: Can't DROP COLUMN `k`; check that it exists
ALTER TABLE t1 DROP INDEX v, LOCK=NONE; ALTER TABLE t1 DROP INDEX v, LOCK=NONE;
connect ddl,localhost,root,,test; connect ddl,localhost,root,,test;
......
...@@ -886,12 +886,12 @@ INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm'); ...@@ -886,12 +886,12 @@ INSERT INTO t1 VALUES (18, 1, DEFAULT, 'mm');
INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm'); INSERT INTO t1 VALUES (28, 1, DEFAULT, 'mm');
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD INDEX idx12 (c) , FORCE, LOCK=NONE; ALTER TABLE t1 ADD INDEX idx12 (c), FORCE, ALGORITHM = INPLACE, LOCK=NONE;
ALTER TABLE t1 ADD INDEX idx12 (c), LOCK=NONE; ALTER TABLE t1 ADD INDEX idx12 (c), LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c) , FORCE, LOCK=NONE; ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), FORCE, ALGORITHM = INPLACE, LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), LOCK=NONE; ALTER TABLE t1 DROP COLUMN h, ADD INDEX idx (c), ALGORITHM = INPLACE, LOCK=NONE;
DROP TABLE t1 ; DROP TABLE t1 ;
......
...@@ -54,7 +54,7 @@ SHOW CREATE TABLE t; ...@@ -54,7 +54,7 @@ SHOW CREATE TABLE t;
SELECT * FROM t; SELECT * FROM t;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t FORCE, LOCK=NONE; ALTER TABLE t FORCE, ALGORITHM=INPLACE, LOCK=NONE;
if (0) {# MDEV-14341 TODO: re-enable this if (0) {# MDEV-14341 TODO: re-enable this
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead';
--send ALTER TABLE t FORCE --send ALTER TABLE t FORCE
......
...@@ -16,9 +16,9 @@ eval INSERT INTO t$n SET i=1; ...@@ -16,9 +16,9 @@ eval INSERT INTO t$n SET i=1;
eval ALTER TABLE t$n ADD INDEX(v), LOCK=NONE; eval ALTER TABLE t$n ADD INDEX(v), LOCK=NONE;
# MDEV-17468 FIXME: Fix this, and remove the 2 --error below. # MDEV-17468 FIXME: Fix this, and remove the 2 --error below.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
eval ALTER TABLE t$n ADD COLUMN k INT, LOCK=NONE; eval ALTER TABLE t$n ADD COLUMN k INT, ALGORITHM=INPLACE, LOCK=NONE;
--error ER_CANT_DROP_FIELD_OR_KEY --error ER_CANT_DROP_FIELD_OR_KEY
eval ALTER TABLE t$n DROP k, LOCK=NONE; eval ALTER TABLE t$n DROP k, ALGORITHM=INPLACE, LOCK=NONE;
eval ALTER TABLE t$n DROP INDEX v, LOCK=NONE; eval ALTER TABLE t$n DROP INDEX v, LOCK=NONE;
dec $n; dec $n;
} }
......
...@@ -626,7 +626,7 @@ CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB; ...@@ -626,7 +626,7 @@ CREATE TABLE mdev6076a (b INT) ENGINE=InnoDB;
INSERT INTO mdev6076a VALUES(2),(1); INSERT INTO mdev6076a VALUES(2),(1);
CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB; CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB;
INSERT INTO mdev6076b VALUES(2),(1); INSERT INTO mdev6076b VALUES(2),(1);
ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, LOCK=NONE; ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED
ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE; ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE;
ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100, ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100,
......
...@@ -5,7 +5,7 @@ SET @@sql_mode = 'STRICT_TRANS_TABLES'; ...@@ -5,7 +5,7 @@ SET @@sql_mode = 'STRICT_TRANS_TABLES';
ALTER TABLE t1 ADD PRIMARY KEY(a); ALTER TABLE t1 ADD PRIMARY KEY(a);
SET @@sql_mode = @old_sql_mode; SET @@sql_mode = @old_sql_mode;
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
LOCK=NONE; ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED
ALTER TABLE t1 ADD id INT AUTO_INCREMENT; ALTER TABLE t1 ADD id INT AUTO_INCREMENT;
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
...@@ -50,7 +50,7 @@ t1 CREATE TABLE `t1` ( ...@@ -50,7 +50,7 @@ t1 CREATE TABLE `t1` (
KEY `id` (`id`,`a`) KEY `id` (`id`,`a`)
) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE; DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Adding an auto-increment column requires a lock. Try LOCK=SHARED
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE; DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
......
...@@ -86,8 +86,8 @@ ALTER TABLE t1 ADD COLUMN d2 TIMESTAMP DEFAULT '2017-05-08 16:23:45', ...@@ -86,8 +86,8 @@ ALTER TABLE t1 ADD COLUMN d2 TIMESTAMP DEFAULT '2017-05-08 16:23:45',
LOCK=NONE; LOCK=NONE;
affected rows: 0 affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0 info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, LOCK=NONE; ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE; ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1; ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1;
......
...@@ -438,28 +438,28 @@ tt CREATE TABLE `tt` ( ...@@ -438,28 +438,28 @@ tt CREATE TABLE `tt` (
PRIMARY KEY (`pk`), PRIMARY KEY (`pk`),
FULLTEXT KEY `ct` (`ct`) FULLTEXT KEY `ct` (`ct`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, ALGORITHM=INSTANT;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, ALGORITHM=INSTANT;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
CREATE TABLE tu ( CREATE TABLE tu (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT, pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
FULLTEXT INDEX(t) FULLTEXT INDEX(t)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, ALGORITHM=INSTANT;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, ALGORITHM=INSTANT;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
DROP TABLE tu; DROP TABLE tu;
CREATE TABLE tv ( CREATE TABLE tv (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT, pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID), UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
FULLTEXT INDEX(t) FULLTEXT INDEX(t)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, ALGORITHM=INSTANT;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, ALGORITHM=INSTANT;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE
DROP TABLE tv; DROP TABLE tv;
ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY; ALTER TABLE t1o CHANGE c1 dB_row_Id INT, ALGORITHM=COPY;
ERROR 42000: Incorrect column name 'dB_row_Id' ERROR 42000: Incorrect column name 'dB_row_Id'
......
...@@ -1598,8 +1598,8 @@ create table t1(f1 int not null, f2 int not null, ...@@ -1598,8 +1598,8 @@ create table t1(f1 int not null, f2 int not null,
primary key (f1), unique key(f1, f2))engine=innodb; primary key (f1), unique key(f1, f2))engine=innodb;
insert into t1 values(1,3), (2,2); insert into t1 values(1,3), (2,2);
alter table t1 drop primary key, lock=none; alter table t1 drop primary key, lock=none;
alter table t1 drop index f1, lock=none; alter table t1 drop index f1, algorithm=inplace, lock=none;
ERROR 0A000: LOCK=NONE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Dropping a primary key is not allowed without also adding a new primary key. Try ALGORITHM=COPY
drop table t1; drop table t1;
# #
# BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP # BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP
......
...@@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` ( ...@@ -23,7 +23,7 @@ t1 CREATE TABLE `t1` (
SPATIAL KEY `c` (`b`), SPATIAL KEY `c` (`b`),
KEY `d` (`d`) KEY `d` (`d`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d; ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, ALGORITHM=INPLACE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
show warnings; show warnings;
Level Code Message Level Code Message
......
...@@ -1383,8 +1383,8 @@ t1c.ibd ...@@ -1383,8 +1383,8 @@ t1c.ibd
t1p.ibd t1p.ibd
tt.ibd tt.ibd
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
LOCK=NONE; ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try LOCK=SHARED ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot drop or rename FTS_DOC_ID. Try ALGORITHM=COPY
SELECT sc.pos FROM information_schema.innodb_sys_columns sc SELECT sc.pos FROM information_schema.innodb_sys_columns sc
INNER JOIN information_schema.innodb_sys_tables st INNER JOIN information_schema.innodb_sys_tables st
ON sc.TABLE_ID=st.TABLE_ID ON sc.TABLE_ID=st.TABLE_ID
......
...@@ -393,7 +393,7 @@ INSERT INTO mdev6076a VALUES(2),(1); ...@@ -393,7 +393,7 @@ INSERT INTO mdev6076a VALUES(2),(1);
CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB; CREATE TABLE mdev6076b (b INT) ENGINE=InnoDB;
INSERT INTO mdev6076b VALUES(2),(1); INSERT INTO mdev6076b VALUES(2),(1);
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, LOCK=NONE; ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE; ALTER TABLE mdev6076a ADD COLUMN a SERIAL FIRST, ALGORITHM=INPLACE;
ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100, ALTER TABLE mdev6076b ADD COLUMN a SERIAL FIRST, AUTO_INCREMENT=100,
ALGORITHM=INPLACE; ALGORITHM=INPLACE;
......
...@@ -11,7 +11,7 @@ SET @@sql_mode = @old_sql_mode; ...@@ -11,7 +11,7 @@ SET @@sql_mode = @old_sql_mode;
# We cannot assign AUTO_INCREMENT values during online index creation. # We cannot assign AUTO_INCREMENT values during online index creation.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
LOCK=NONE; ALGORITHM=INPLACE, LOCK=NONE;
--error ER_WRONG_AUTO_KEY --error ER_WRONG_AUTO_KEY
ALTER TABLE t1 ADD id INT AUTO_INCREMENT; ALTER TABLE t1 ADD id INT AUTO_INCREMENT;
...@@ -42,7 +42,7 @@ SHOW CREATE TABLE t1; ...@@ -42,7 +42,7 @@ SHOW CREATE TABLE t1;
# We cannot assign AUTO_INCREMENT values during online index creation. # We cannot assign AUTO_INCREMENT values during online index creation.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
DROP COLUMN id, AUTO_INCREMENT = 42, LOCK=NONE; DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY, ALTER TABLE t1 DROP PRIMARY KEY, ADD id INT AUTO_INCREMENT PRIMARY KEY,
DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE; DROP COLUMN id, AUTO_INCREMENT = 42, ALGORITHM=INPLACE;
......
...@@ -67,7 +67,7 @@ SELECT u1, COUNT(DISTINCT d1) FROM t1 GROUP BY u1; ...@@ -67,7 +67,7 @@ SELECT u1, COUNT(DISTINCT d1) FROM t1 GROUP BY u1;
ALTER TABLE t1 ADD COLUMN d2 TIMESTAMP DEFAULT '2017-05-08 16:23:45', ALTER TABLE t1 ADD COLUMN d2 TIMESTAMP DEFAULT '2017-05-08 16:23:45',
LOCK=NONE; LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, LOCK=NONE; ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE, LOCK=NONE;
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE; ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1, ALGORITHM=INPLACE;
ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1; ALTER TABLE t1 ADD COLUMN d3 TIMESTAMP DEFAULT d1;
......
...@@ -195,20 +195,20 @@ ALGORITHM=INPLACE, LOCK=SHARED; ...@@ -195,20 +195,20 @@ ALGORITHM=INPLACE, LOCK=SHARED;
SHOW CREATE TABLE tt; SHOW CREATE TABLE tt;
# Non-instant ADD COLUMN would require the table to be rebuilt. # Non-instant ADD COLUMN would require the table to be rebuilt.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL FIRST, ALGORITHM=INSTANT;
# This is still non-instant ADD COLUMN, because FTS_DOC_ID is hidden. # This is still non-instant ADD COLUMN, because FTS_DOC_ID is hidden.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; ALTER TABLE tt ADD COLUMN c CHAR(1) NOT NULL, ALGORITHM=INSTANT;
CREATE TABLE tu ( CREATE TABLE tu (
pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT, pk INT PRIMARY KEY, FTS_DOC_ID BIGINT UNSIGNED NOT NULL, t TEXT,
FULLTEXT INDEX(t) FULLTEXT INDEX(t)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL FIRST, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; ALTER TABLE tu ADD COLUMN c CHAR(1) NOT NULL, ALGORITHM=INSTANT;
DROP TABLE tu; DROP TABLE tu;
CREATE TABLE tv ( CREATE TABLE tv (
...@@ -216,10 +216,10 @@ CREATE TABLE tv ( ...@@ -216,10 +216,10 @@ CREATE TABLE tv (
UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID), UNIQUE INDEX FTS_DOC_ID_INDEX(FTS_DOC_ID),
FULLTEXT INDEX(t) FULLTEXT INDEX(t)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, LOCK=NONE; ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL FIRST, ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, LOCK=NONE; ALTER TABLE tv ADD COLUMN c CHAR(1) NOT NULL, ALGORITHM=INSTANT;
DROP TABLE tv; DROP TABLE tv;
# DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR are reserved InnoDB system column names. # DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR are reserved InnoDB system column names.
......
...@@ -921,7 +921,7 @@ create table t1(f1 int not null, f2 int not null, ...@@ -921,7 +921,7 @@ create table t1(f1 int not null, f2 int not null,
insert into t1 values(1,3), (2,2); insert into t1 values(1,3), (2,2);
alter table t1 drop primary key, lock=none; alter table t1 drop primary key, lock=none;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 drop index f1, lock=none; alter table t1 drop index f1, algorithm=inplace, lock=none;
drop table t1; drop table t1;
--echo # --echo #
......
...@@ -11,8 +11,8 @@ show errors; ...@@ -11,8 +11,8 @@ show errors;
drop table t1; drop table t1;
create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb; create table t1(a int not null, b geometry not null, d int,spatial key c(b), key d(d)) engine=innodb;
show create table t1; show create table t1;
--error 1846 --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d; ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, ALGORITHM=INPLACE;
show warnings; show warnings;
show errors; show errors;
ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED; ALTER ONLINE TABLE t1 ADD PRIMARY KEY(a),DROP INDEX d, LOCK=SHARED;
......
...@@ -609,7 +609,7 @@ ALGORITHM=INPLACE; ...@@ -609,7 +609,7 @@ ALGORITHM=INPLACE;
# This would create a hidden FTS_DOC_ID column, which cannot be done online. # This would create a hidden FTS_DOC_ID column, which cannot be done online.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL, ALTER TABLE t1o CHANGE FTS_DOC_ID foo_id BIGINT UNSIGNED NOT NULL,
LOCK=NONE; ALGORITHM=INPLACE, LOCK=NONE;
# This should not show duplicates. # This should not show duplicates.
SELECT sc.pos FROM information_schema.innodb_sys_columns sc SELECT sc.pos FROM information_schema.innodb_sys_columns sc
......
...@@ -75,10 +75,10 @@ INSERT INTO fts_test (title,body) VALUES ...@@ -75,10 +75,10 @@ INSERT INTO fts_test (title,body) VALUES
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'), ('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...'); ('MySQL Security','When configured properly, MySQL ...');
CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE; ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE; ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT; ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
SELECT * FROM fts_test WHERE MATCH (title, body) SELECT * FROM fts_test WHERE MATCH (title, body)
......
...@@ -111,11 +111,11 @@ INSERT INTO fts_test (title,body) VALUES ...@@ -111,11 +111,11 @@ INSERT INTO fts_test (title,body) VALUES
# We could support online fulltext index creation when a FTS_DOC_ID # We could support online fulltext index creation when a FTS_DOC_ID
# column already exists. This has not been implemented yet. # column already exists. This has not been implemented yet.
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE; ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY, LOCK=NONE;
ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE; ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE, LOCK=NONE;
ALTER TABLE fts_test ROW_FORMAT=REDUNDANT; ALTER TABLE fts_test ROW_FORMAT=REDUNDANT;
SELECT * FROM fts_test WHERE MATCH (title, body) SELECT * FROM fts_test WHERE MATCH (title, body)
......
...@@ -759,17 +759,6 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ...@@ -759,17 +759,6 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
alter table t1 add b geometry not null default st_geomfromtext('POINT(0 0)'), alter table t1 add b geometry not null default st_geomfromtext('POINT(0 0)'),
add spatial index(b), algorithm=copy; add spatial index(b), algorithm=copy;
DROP table t1; DROP table t1;
#
# BUG#20111575 ALTER TABLE...ADD SPATIAL INDEX...LOCK NONE IS REFUSED
# WITHOUT STATING A REASON
#
CREATE TABLE t1(p point NOT NULL) ENGINE=innodb;
ALTER TABLE t1 ADD SPATIAL INDEX(p), LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
ALTER TABLE t1 ADD SPATIAL INDEX(p);
ALTER TABLE t1 FORCE, LOCK=NONE;
ERROR 0A000: LOCK=NONE is not supported. Reason: Do not support online operation on table with GIS index. Try LOCK=SHARED
DROP TABLE t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb; create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10; set timestamp=10;
insert into t1 values(default); insert into t1 values(default);
......
...@@ -747,18 +747,6 @@ alter table t1 add b geometry not null default st_geomfromtext('POINT(0 0)'), ...@@ -747,18 +747,6 @@ alter table t1 add b geometry not null default st_geomfromtext('POINT(0 0)'),
add spatial index(b), algorithm=copy; add spatial index(b), algorithm=copy;
DROP table t1; DROP table t1;
--echo #
--echo # BUG#20111575 ALTER TABLE...ADD SPATIAL INDEX...LOCK NONE IS REFUSED
--echo # WITHOUT STATING A REASON
--echo #
CREATE TABLE t1(p point NOT NULL) ENGINE=innodb;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 ADD SPATIAL INDEX(p), LOCK=NONE;
ALTER TABLE t1 ADD SPATIAL INDEX(p);
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 FORCE, LOCK=NONE;
DROP TABLE t1;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb; create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10; set timestamp=10;
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
......
set system_versioning_alter_history=keep; set system_versioning_alter_history=keep;
create or replace table t (a int); create or replace table t (a int);
alter table t add system versioning, lock=none; alter table t add system versioning, lock=none;
ERROR 0A000: LOCK=NONE is not supported. Reason: Not implemented for system-versioned timestamp tables. Try LOCK=SHARED alter table t drop system versioning;
alter table t add system versioning, algorithm=inplace; alter table t add system versioning, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned timestamp tables. Try ALGORITHM=COPY ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned timestamp tables. Try ALGORITHM=COPY
alter table t add system versioning, lock=shared; alter table t add system versioning, lock=shared;
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
set system_versioning_alter_history=keep; set system_versioning_alter_history=keep;
create or replace table t (a int); create or replace table t (a int);
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t add system versioning, lock=none; alter table t add system versioning, lock=none;
alter table t drop system versioning;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t add system versioning, algorithm=inplace; alter table t add system versioning, algorithm=inplace;
alter table t add system versioning, lock=shared; alter table t add system versioning, lock=shared;
......
...@@ -177,8 +177,8 @@ bool Alter_info::supports_algorithm(THD *thd, ...@@ -177,8 +177,8 @@ bool Alter_info::supports_algorithm(THD *thd,
} }
bool Alter_info::supports_lock(THD *thd, bool Alter_info::supports_lock(THD *thd, bool online,
const Alter_inplace_info *ha_alter_info) Alter_inplace_info *ha_alter_info)
{ {
switch (ha_alter_info->inplace_supported) { switch (ha_alter_info->inplace_supported) {
case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: case HA_ALTER_INPLACE_EXCLUSIVE_LOCK:
...@@ -206,10 +206,15 @@ bool Alter_info::supports_lock(THD *thd, ...@@ -206,10 +206,15 @@ bool Alter_info::supports_lock(THD *thd,
case HA_ALTER_INPLACE_NOT_SUPPORTED: case HA_ALTER_INPLACE_NOT_SUPPORTED:
case HA_ALTER_INPLACE_SHARED_LOCK: case HA_ALTER_INPLACE_SHARED_LOCK:
if (requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE) if (requested_lock == Alter_info::ALTER_TABLE_LOCK_NONE)
{
if (online)
ha_alter_info->inplace_supported= HA_ALTER_INPLACE_NOT_SUPPORTED;
else
{ {
ha_alter_info->report_unsupported_error("LOCK=NONE", "LOCK=SHARED"); ha_alter_info->report_unsupported_error("LOCK=NONE", "LOCK=SHARED");
return true; return true;
} }
}
return false; return false;
case HA_ALTER_ERROR: case HA_ALTER_ERROR:
return true; return true;
......
...@@ -226,7 +226,7 @@ class Alter_info ...@@ -226,7 +226,7 @@ class Alter_info
@retval false Supported lock type @retval false Supported lock type
@retval true Not supported value @retval true Not supported value
*/ */
bool supports_lock(THD *thd, const Alter_inplace_info *ha_alter_info); bool supports_lock(THD *thd, bool, Alter_inplace_info *ha_alter_info);
/** /**
Return user requested algorithm. If user does not specify Return user requested algorithm. If user does not specify
......
...@@ -10839,7 +10839,7 @@ do_continue:; ...@@ -10839,7 +10839,7 @@ do_continue:;
} }
if (alter_info->supports_algorithm(thd, &ha_alter_info) || if (alter_info->supports_algorithm(thd, &ha_alter_info) ||
alter_info->supports_lock(thd, &ha_alter_info)) alter_info->supports_lock(thd, online, &ha_alter_info))
{ {
cleanup_table_after_inplace_alter(&altered_table); cleanup_table_after_inplace_alter(&altered_table);
goto err_new_table_cleanup; goto err_new_table_cleanup;
......
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