Commit 38b89a61 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9103 Altering table comment does a full copy

following InnoDB's logic, altering a comment or a default
field's value needs "NO_LOCK", not EXCLUSIVE
parent 3c6b7717
......@@ -2,15 +2,9 @@ drop table if exists t1,t2,t3;
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);
alter online table t1 modify b int default 5;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter online table t1 change b new_name int;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter online table t1 modify e enum('a','b','c');
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter online table t1 comment "new comment";
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter online table t1 rename to t2;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter online table t1 algorithm=INPLACE, lock=NONE;
alter online table t1;
alter table t1 algorithm=INPLACE;
......@@ -40,10 +34,13 @@ 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;
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
alter online table t1 rename to t2;
ERROR 0A000: LOCK=NONE/SHARED is not supported for this operation. Try LOCK=EXCLUSIVE.
alter table t1 engine=innodb;
alter table t1 add index (b);
alter online table t1 add index c (c);
alter online table t1 drop index b;
alter online table t1 comment "new comment";
drop table t1;
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);
......
......@@ -7,22 +7,16 @@
drop table if exists t1,t2,t3;
--enable_warnings
#
# Test of things that can not be done online
# Test of things that can be done online
#
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);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 modify b int default 5;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 change b new_name int;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 modify e enum('a','b','c');
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 comment "new comment";
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 rename to t2;
# No OPs
......@@ -68,11 +62,14 @@ alter online table t1 modify c varchar(100);
alter online table t1 add f int;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter online table t1 engine=memory;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 rename to t2;
alter table t1 engine=innodb;
alter table t1 add index (b);
alter online table t1 add index c (c);
alter online table t1 drop index b;
alter online table t1 comment "new comment";
drop table t1;
create temporary table t1 (a int not null primary key, b int, c varchar(80), e enum('a','b'));
......
......@@ -4236,7 +4236,7 @@ handler::check_if_supported_inplace_alter(TABLE *altered_table,
IS_EQUAL_PACK_LENGTH : IS_EQUAL_YES;
if (table->file->check_if_incompatible_data(create_info, table_changes)
== COMPATIBLE_DATA_YES)
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
DBUG_RETURN(HA_ALTER_INPLACE_NO_LOCK);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
......
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