1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

don't do ALTER IGNORE TABLE online

because online means we'll apply events from the binlog, and
ignore means that bad rows will be skipped. So a bad Write_row_log_event
will be skipped and a following Update_row_log_event will fail to
apply.
This commit is contained in:
Sergei Golubchik
2022-07-15 08:52:33 +02:00
parent aa9e173e9e
commit 472c3d082f
5 changed files with 22 additions and 2 deletions

View File

@ -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 # MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER
# #
create table t (a char(1)); create table t (a char(1));

View File

@ -1,6 +1,14 @@
--source include/binlog_combinations.inc --source include/binlog_combinations.inc
--source include/have_innodb.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 #
--echo # MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER --echo # MDEV-28771 Assertion `table->in_use&&tdc->flushed' failed after ALTER
--echo # --echo #

View File

@ -654,8 +654,9 @@ create table t1 (a char(9), b char(9) as (a) stored);
insert into t1(a) values ('foobar'); insert into t1(a) values ('foobar');
set debug_sync= 'now wait_for downgraded'; set debug_sync= 'now wait_for downgraded';
connection con2; connection con2;
set sql_mode='';
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit'; 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; connection default;
update t1 set a = 'foobarqux'; update t1 set a = 'foobarqux';
set debug_sync= 'now signal goforit'; set debug_sync= 'now signal goforit';
@ -663,6 +664,7 @@ connection con2;
Warnings: Warnings:
Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 2
set sql_mode=default;
connection default; connection default;
drop table t1; drop table t1;
set debug_sync= reset; set debug_sync= reset;

View File

@ -810,8 +810,9 @@ insert into t1(a) values ('foobar');
--send set debug_sync= 'now wait_for downgraded' --send set debug_sync= 'now wait_for downgraded'
--connection con2 --connection con2
set sql_mode='';
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit'; 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 --connection default
--reap --reap
@ -820,6 +821,7 @@ set debug_sync= 'now signal goforit';
--connection con2 --connection con2
--reap --reap
set sql_mode=default;
--connection default --connection default
drop table t1; drop table t1;
set debug_sync= reset; set debug_sync= reset;

View File

@ -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 if (alter_info->requested_lock > Alter_info::ALTER_TABLE_LOCK_NONE
|| alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING || alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING
|| thd->lex->sql_command == SQLCOM_OPTIMIZE || thd->lex->sql_command == SQLCOM_OPTIMIZE
|| ignore
|| alter_info->algorithm(thd) > Alter_info::ALTER_TABLE_ALGORITHM_COPY) || alter_info->algorithm(thd) > Alter_info::ALTER_TABLE_ALGORITHM_COPY)
online= false; online= false;