diff --git a/mysql-test/main/alter_table_online.result b/mysql-test/main/alter_table_online.result index 903fa86de94..a0850b0b8fc 100644 --- a/mysql-test/main/alter_table_online.result +++ b/mysql-test/main/alter_table_online.result @@ -1,4 +1,11 @@ # +# alter ignore cannot be done online +# +create table t (a int); +alter ignore table t add primary key (a), algorithm=copy, lock=none; +ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED +drop table t; +# # MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER # create table t (a char(1)); diff --git a/mysql-test/main/alter_table_online.test b/mysql-test/main/alter_table_online.test index 92710f46cbf..03cd78084fd 100644 --- a/mysql-test/main/alter_table_online.test +++ b/mysql-test/main/alter_table_online.test @@ -1,6 +1,14 @@ --source include/binlog_combinations.inc --source include/have_innodb.inc +--echo # +--echo # alter ignore cannot be done online +--echo # +create table t (a int); +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter ignore table t add primary key (a), algorithm=copy, lock=none; +drop table t; + --echo # --echo # MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER --echo # diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result index ee4772dc289..9f33fba4b52 100644 --- a/mysql-test/main/alter_table_online_debug.result +++ b/mysql-test/main/alter_table_online_debug.result @@ -654,8 +654,9 @@ create table t1 (a char(9), b char(9) as (a) stored); insert into t1(a) values ('foobar'); set debug_sync= 'now wait_for downgraded'; connection con2; +set sql_mode=''; set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit'; -alter ignore table t1 drop b, add b char(3) as (a) stored, algorithm=copy, lock=none; +alter table t1 drop b, add b char(3) as (a) stored, algorithm=copy, lock=none; connection default; update t1 set a = 'foobarqux'; set debug_sync= 'now signal goforit'; @@ -663,6 +664,7 @@ connection con2; Warnings: Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 2 +set sql_mode=default; connection default; drop table t1; set debug_sync= reset; diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test index 26fe2d12e8f..db40f3c5650 100644 --- a/mysql-test/main/alter_table_online_debug.test +++ b/mysql-test/main/alter_table_online_debug.test @@ -810,8 +810,9 @@ insert into t1(a) values ('foobar'); --send set debug_sync= 'now wait_for downgraded' --connection con2 +set sql_mode=''; set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit'; ---send alter ignore table t1 drop b, add b char(3) as (a) stored, algorithm=copy, lock=none +--send alter table t1 drop b, add b char(3) as (a) stored, algorithm=copy, lock=none --connection default --reap @@ -820,6 +821,7 @@ set debug_sync= 'now signal goforit'; --connection con2 --reap +set sql_mode=default; --connection default drop table t1; set debug_sync= reset; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f7dc348229f..9bcfd304f4e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10029,6 +10029,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db, if (alter_info->requested_lock > Alter_info::ALTER_TABLE_LOCK_NONE || alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING || thd->lex->sql_command == SQLCOM_OPTIMIZE + || ignore || alter_info->algorithm(thd) > Alter_info::ALTER_TABLE_ALGORITHM_COPY) online= false;