diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-06-30 12:12:00 +0200 |
---|---|---|
committer | Nikita Malyavin <nikitamalyavin@gmail.com> | 2022-08-23 16:36:26 +0300 |
commit | 35c9de883ffbcc0ab460935de7040f43d193bdc6 (patch) | |
tree | b7755261962b91b04e97cdb9a9014a98a9bc5149 | |
parent | bbe5684a6980f3ffa651dff2c1d2a747acb21df7 (diff) | |
download | mariadb-git-35c9de883ffbcc0ab460935de7040f43d193bdc6.tar.gz |
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
-rw-r--r-- | mysql-test/main/alter_table_online_debug.result | 30 | ||||
-rw-r--r-- | mysql-test/main/alter_table_online_debug.test | 26 | ||||
-rw-r--r-- | sql/sql_table.cc | 4 |
3 files changed, 58 insertions, 2 deletions
diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result index 30a0ac919ff..d341d3bab7e 100644 --- a/mysql-test/main/alter_table_online_debug.result +++ b/mysql-test/main/alter_table_online_debug.result @@ -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 +select * from t1; +a +1 +2 +3 +NULL +NULL +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 44e5d1ec24a..5b4fe1f3724 100644 --- a/mysql-test/main/alter_table_online_debug.test +++ b/mysql-test/main/alter_table_online_debug.test @@ -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; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0588c3ab026..71ebad1d382 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11423,7 +11423,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 @@ -11437,7 +11436,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) |