mirror of
https://github.com/MariaDB/server.git
synced 2025-06-16 11:21:15 +03:00
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
This commit is contained in:
@ -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'));
|
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 modify b int default 5;
|
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;
|
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');
|
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";
|
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 algorithm=INPLACE, lock=NONE;
|
||||||
alter online table t1;
|
alter online table t1;
|
||||||
alter table t1 algorithm=INPLACE;
|
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.
|
ERROR 0A000: LOCK=NONE is not supported for this operation. Try LOCK=SHARED.
|
||||||
alter online table t1 engine=memory;
|
alter online table t1 engine=memory;
|
||||||
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
|
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 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);
|
||||||
alter online table t1 drop index b;
|
alter online table t1 drop index b;
|
||||||
|
alter online table t1 comment "new comment";
|
||||||
drop table t1;
|
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);
|
||||||
|
@ -7,22 +7,16 @@
|
|||||||
drop table if exists t1,t2,t3;
|
drop table if exists t1,t2,t3;
|
||||||
--enable_warnings
|
--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'));
|
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 modify b int default 5;
|
alter online table t1 modify b int default 5;
|
||||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
|
||||||
alter online table t1 change b new_name int;
|
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');
|
alter online table t1 modify e enum('a','b','c');
|
||||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
|
||||||
alter online table t1 comment "new comment";
|
alter online table t1 comment "new comment";
|
||||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
|
||||||
alter online table t1 rename to t2;
|
|
||||||
|
|
||||||
# No OPs
|
# No OPs
|
||||||
|
|
||||||
@ -68,11 +62,14 @@ alter online table t1 modify c varchar(100);
|
|||||||
alter online table t1 add f int;
|
alter online table t1 add f int;
|
||||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||||
alter online table t1 engine=memory;
|
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 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);
|
||||||
alter online table t1 drop index b;
|
alter online table t1 drop index b;
|
||||||
|
alter online table t1 comment "new comment";
|
||||||
drop table t1;
|
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'));
|
||||||
|
@ -4236,7 +4236,7 @@ handler::check_if_supported_inplace_alter(TABLE *altered_table,
|
|||||||
IS_EQUAL_PACK_LENGTH : IS_EQUAL_YES;
|
IS_EQUAL_PACK_LENGTH : IS_EQUAL_YES;
|
||||||
if (table->file->check_if_incompatible_data(create_info, table_changes)
|
if (table->file->check_if_incompatible_data(create_info, table_changes)
|
||||||
== COMPATIBLE_DATA_YES)
|
== COMPATIBLE_DATA_YES)
|
||||||
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
|
DBUG_RETURN(HA_ALTER_INPLACE_NO_LOCK);
|
||||||
|
|
||||||
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
|
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user