Commit 93049e3d authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-28959 Online alter ignores strict table mode

* don't disable warnings when catching up
* do propagate warnings up like copy_data_between_tables() does
parent 13f1e970
......@@ -582,3 +582,33 @@ set debug_sync= 'reset';
drop table t1;
drop table t2;
drop table t3;
#
# MDEV-28959 Online alter ignores strict table mode
#
create table t1 (a int);
insert into t1 values (1),(2),(3);
set debug_sync= 'now wait_for downgraded';
connection con2;
set sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES';
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
alter table t1 modify a int not null, algorithm=copy, lock=none;
connection default;
insert into t1 values (null),(null);
set debug_sync= 'now signal goforit';
connection con2;
ERROR 01000: Data truncated for column 'a' at row 4
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select * from t1;
a
1
2
3
NULL
NULL
connection default;
drop table t1;
set debug_sync= reset;
......@@ -720,3 +720,29 @@ set debug_sync= 'reset';
drop table t1;
drop table t2;
drop table t3;
--echo #
--echo # MDEV-28959 Online alter ignores strict table mode
--echo #
create table t1 (a int);
insert into t1 values (1),(2),(3);
--send set debug_sync= 'now wait_for downgraded'
--connection con2
set sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES';
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
--send alter table t1 modify a int not null, algorithm=copy, lock=none
--connection default
--reap
insert into t1 values (null),(null);
set debug_sync= 'now signal goforit';
--connection con2
--error WARN_DATA_TRUNCATED
--reap
show create table t1;
select * from t1;
--connection default
drop table t1;
set debug_sync= reset;
......@@ -11566,7 +11566,6 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
thd_progress_report(thd, 0, my_b_write_tell(log_file));
Abort_on_warning_instant_set old_abort_on_warning(thd, 0);
Has_default_error_handler hdeh;
thd->push_internal_handler(&hdeh);
do
......@@ -11580,7 +11579,8 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
thd->set_n_backup_active_arena(&event_arena, &backup_arena);
error= ev->apply_event(rgi);
thd->restore_active_arena(&event_arena, &backup_arena);
if (thd->is_error())
error= 1;
event_arena.free_items();
free_root(&event_mem_root, MYF(MY_KEEP_PREALLOC));
if (ev != rgi->rli->relay_log.description_event_for_exec)
......
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