Commit 2bb0e713 authored by Daniel Black's avatar Daniel Black

Alter online table x (no options) possible

This no-op of an operations should be able to occur without locks and
occur online.
parent 9088f26f
...@@ -11,6 +11,7 @@ alter online table t1 comment "new comment"; ...@@ -11,6 +11,7 @@ alter online table t1 comment "new comment";
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 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 algorithm=INPLACE, lock=NONE;
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,7 +7,7 @@ ...@@ -7,7 +7,7 @@
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
--enable_warnings --enable_warnings
# #
# Test of things that can be done online # Test of things that can not 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'));
...@@ -24,6 +24,10 @@ alter online table t1 comment "new comment"; ...@@ -24,6 +24,10 @@ alter online table t1 comment "new comment";
--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;
# No OPs
alter online table t1 algorithm=INPLACE, lock=NONE;
drop table t1; drop table t1;
# #
......
...@@ -8431,6 +8431,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -8431,6 +8431,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
THD_STAGE_INFO(thd, stage_setup); THD_STAGE_INFO(thd, stage_setup);
if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME | if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME |
Alter_info::ALTER_KEYS_ONOFF)) && Alter_info::ALTER_KEYS_ONOFF)) &&
alter_info->flags != 0 &&
alter_info->requested_algorithm != alter_info->requested_algorithm !=
Alter_info::ALTER_TABLE_ALGORITHM_COPY && Alter_info::ALTER_TABLE_ALGORITHM_COPY &&
!table->s->tmp_table) // no need to touch frm !table->s->tmp_table) // no need to touch frm
...@@ -8449,6 +8450,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, ...@@ -8449,6 +8450,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(res); DBUG_RETURN(res);
} }
if (alter_info->flags != 0)
handle_if_exists_options(thd, table, alter_info); handle_if_exists_options(thd, table, alter_info);
/* /*
......
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