summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-02-11 12:25:23 +0100
committerSergei Golubchik <serg@mariadb.org>2016-02-15 13:02:21 +0100
commit38b89a61c3ace83b32c079489922a0cae5106b56 (patch)
tree6da9b918888b6ba8479e296d7707cbb37b2c1394
parent3c6b771753d8666120fa3cb81d1586d214d85a58 (diff)
downloadmariadb-git-38b89a61c3ace83b32c079489922a0cae5106b56.tar.gz
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
-rw-r--r--mysql-test/r/alter_table_online.result9
-rw-r--r--mysql-test/t/alter_table_online.test11
-rw-r--r--sql/handler.cc2
3 files changed, 8 insertions, 14 deletions
diff --git a/mysql-test/r/alter_table_online.result b/mysql-test/r/alter_table_online.result
index 864ad724bc3..db7319cadf1 100644
--- a/mysql-test/r/alter_table_online.result
+++ b/mysql-test/r/alter_table_online.result
@@ -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);
diff --git a/mysql-test/t/alter_table_online.test b/mysql-test/t/alter_table_online.test
index 20dbfe9c46a..a160abc8fe2 100644
--- a/mysql-test/t/alter_table_online.test
+++ b/mysql-test/t/alter_table_online.test
@@ -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'));
diff --git a/sql/handler.cc b/sql/handler.cc
index 4294a1aaf72..51a608304aa 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -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);
}