Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mysql-test/r/alter_table_online.result
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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;
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);
Expand Down
6 changes: 5 additions & 1 deletion mysql-test/t/alter_table_online.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
drop table if exists t1,t2,t3;
--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'));
Expand All @@ -24,6 +24,10 @@ alter online table t1 comment "new comment";
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter online table t1 rename to t2;

# No OPs

alter online table t1 algorithm=INPLACE, lock=NONE;

drop table t1;

#
Expand Down
4 changes: 3 additions & 1 deletion sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8429,6 +8429,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
THD_STAGE_INFO(thd, stage_setup);
if (!(alter_info->flags & ~(Alter_info::ALTER_RENAME |
Alter_info::ALTER_KEYS_ONOFF)) &&
alter_info->flags != 0 &&
alter_info->requested_algorithm !=
Alter_info::ALTER_TABLE_ALGORITHM_COPY &&
!table->s->tmp_table) // no need to touch frm
Expand All @@ -8447,7 +8448,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(res);
}

handle_if_exists_options(thd, table, alter_info);
if (alter_info->flags != 0)
handle_if_exists_options(thd, table, alter_info);

/*
Look if we have to do anything at all.
Expand Down