diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-06-30 12:12:00 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-03-20 11:28:50 +0100 |
commit | 8dc9369a9595060578e10f56c538232de26a71ad (patch) | |
tree | 55e226cccd89ab3bfe13e4ebc4f3ec3a355556bb | |
parent | ab573d4fa39e8c03329222f8dc0a2a6d7b19fee1 (diff) | |
download | mariadb-git-8dc9369a9595060578e10f56c538232de26a71ad.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 31d35c08a17..274b16547d3 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 COLLATE=latin1_swedish_ci +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..62657cb240a 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 92bcea5e193..07dda6ee1cb 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11564,7 +11564,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 @@ -11578,7 +11577,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) |