From 2464ee758afb588b39887cab7828493cbcc2da87 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 12 Mar 2024 13:54:30 +0200 Subject: [PATCH] MDEV-33655 Remove alter_algorithm Remove alter_algorithm but keep the variable as no-op (with a warning). The reasons for removing alter_algorithm are: - alter_algorithm was introduced as a replacement for the old_alter_table that was used to force the usage of the original alter table algorithm (copy) in the cases where the new alter algorithm did not work. The new option was added as a way to force the usage of a specific algorithm when it should instead have made it possible to disable algorithms that would not work for some reason. - alter_algorithm introduced some cases where ALTER TABLE would not work without specifying the ALGORITHM=XXX option together with ALTER TABLE. - Having different values of alter_algorithm on master and slave could cause slave to stop unexpectedly. - ALTER TABLE FORCE, as used by mariadb-upgrade, would not always work if alter_algorithm was set for the server. - As part of the MDEV-33449 "improving repair of tables" it become clear that alter- algorithm made it harder to provide a better and more consistent ALTER TABLE FORCE and REPAIR TABLE and it would be better to remove it. --- mysql-test/main/alter_table.result | 20 +- mysql-test/main/alter_table.test | 17 +- mysql-test/main/ignored_index_innodb.result | 20 +- mysql-test/main/ignored_index_innodb.test | 10 +- mysql-test/main/innodb_mysql_sync.result | 61 +-- mysql-test/main/innodb_mysql_sync.test | 46 +- ...ezones_with_alter_algorithm_inplace.result | 18 - ...imezones_with_alter_algorithm_inplace.test | 40 -- .../main/mysql_tzinfo_to_sql_symlink.result | 12 + mysql-test/main/mysql_upgrade.result | 163 ------ mysql-test/main/mysql_upgrade.test | 13 - mysql-test/main/mysqld--help.result | 4 +- mysql-test/main/repair.result | 38 ++ mysql-test/main/repair.test | 19 + .../galera/r/mariadb_tzinfo_to_sql.result | 16 + .../innodb/r/alter_algorithm,INPLACE.rdiff | 150 ------ .../innodb/r/alter_algorithm,INSTANT.rdiff | 137 ----- .../innodb/r/alter_algorithm,NOCOPY.rdiff | 142 ----- .../suite/innodb/r/alter_algorithm.result | 398 +++++++++++++- .../suite/innodb/r/alter_algorithm2.result | 26 +- .../r/alter_not_null,COPY,NON-STRICT.rdiff | 79 --- .../innodb/r/alter_not_null,COPY,STRICT.rdiff | 109 ---- .../r/alter_not_null,INPLACE,STRICT.rdiff | 98 ---- .../innodb/r/alter_not_null,STRICT.result | 198 +++++++ .../suite/innodb/r/alter_not_null.result | 162 +++++- .../suite/innodb/r/innodb_bug53592.result | 15 - .../suite/innodb/t/alter_algorithm-master.opt | 1 + .../innodb/t/alter_algorithm.combinations | 15 - mysql-test/suite/innodb/t/alter_algorithm.inc | 146 +++++- .../suite/innodb/t/alter_algorithm.test | 151 +----- .../suite/innodb/t/alter_algorithm2.test | 22 +- .../innodb/t/alter_not_null.combinations | 5 - mysql-test/suite/innodb/t/alter_not_null.inc | 106 ++++ mysql-test/suite/innodb/t/alter_not_null.test | 105 +--- .../suite/innodb/t/innodb_bug53592.test | 29 -- mysql-test/suite/parts/r/alter_table.result | 5 +- .../parts/r/partition_alter_instant.result | 7 +- mysql-test/suite/parts/t/alter_table.test | 6 +- .../parts/t/partition_alter_instant.test | 7 +- .../suite/rpl/r/rpl_start_alter_ftwrl.result | 7 +- .../rpl/r/rpl_start_alter_instant.result | 22 +- .../rpl/r/rpl_start_alter_options.result | 493 ------------------ .../suite/rpl/t/rpl_start_alter_ftwrl.test | 3 +- .../suite/rpl/t/rpl_start_alter_instant.test | 7 +- .../suite/rpl/t/rpl_start_alter_options.test | 31 -- .../sys_vars/r/alter_algorithm_basic.result | 78 +-- .../sys_vars/r/sysvars_server_embedded.result | 2 +- .../r/sysvars_server_notembedded.result | 2 +- .../sys_vars/t/alter_algorithm_basic.test | 47 -- sql/mysqld.cc | 1 + sql/rpl_parallel.cc | 2 - sql/slave.cc | 3 - sql/sql_alter.cc | 6 +- sql/sql_class.h | 2 +- sql/sql_table.cc | 5 +- sql/sys_vars.cc | 19 +- .../spider/bugfix/r/mdev_32683.result | 16 - .../spider/bugfix/t/mdev_32683.test | 14 - 58 files changed, 1171 insertions(+), 2205 deletions(-) delete mode 100644 mysql-test/main/load_timezones_with_alter_algorithm_inplace.result delete mode 100644 mysql-test/main/load_timezones_with_alter_algorithm_inplace.test delete mode 100644 mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff delete mode 100644 mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff delete mode 100644 mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff delete mode 100644 mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff delete mode 100644 mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff delete mode 100644 mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff create mode 100644 mysql-test/suite/innodb/r/alter_not_null,STRICT.result create mode 100644 mysql-test/suite/innodb/t/alter_algorithm-master.opt delete mode 100644 mysql-test/suite/innodb/t/alter_algorithm.combinations delete mode 100644 mysql-test/suite/innodb/t/alter_not_null.combinations create mode 100644 mysql-test/suite/innodb/t/alter_not_null.inc delete mode 100644 mysql-test/suite/rpl/r/rpl_start_alter_options.result delete mode 100644 mysql-test/suite/rpl/t/rpl_start_alter_options.test delete mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result delete mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result index e987cd67de9..4439e39eace 100644 --- a/mysql-test/main/alter_table.result +++ b/mysql-test/main/alter_table.result @@ -1654,13 +1654,11 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE; affected rows: 0 ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4; # -# 2: Test ALGORITHM + alter_algorithm +# 2: Test ALGORITHM keywords # -SET SESSION alter_algorithm= 1; -affected rows: 0 ALTER TABLE t1 ADD INDEX i1(b); -affected rows: 2 -info: Records: 2 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 @@ -1676,8 +1674,6 @@ affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 1 Warnings: Note 1831 Duplicate index `i4`. This is deprecated and will be disallowed in a future release -SET SESSION alter_algorithm= 0; -affected rows: 0 ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4; # # 3: Test unsupported in-place operation @@ -3123,3 +3119,13 @@ DROP TABLE t; # # End of 10.7 tests # +# +# MDEV-33655 Remove alter_algorithm +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (a INT) ENGINE=MERGE, UNION(t1); +ALTER TABLE t2 COMMENT 'x', LOCK=SHARED; +DROP TABLE t2,t1; +# +# End of 11.5 tests +# diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index 48175f493eb..b91285cfff9 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -1462,16 +1462,14 @@ ALTER TABLE m1 ENABLE KEYS, ALGORITHM= INPLACE; ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4; --echo # ---echo # 2: Test ALGORITHM + alter_algorithm +--echo # 2: Test ALGORITHM keywords --echo # --enable_info -SET SESSION alter_algorithm= 1; ALTER TABLE t1 ADD INDEX i1(b); ALTER TABLE t1 ADD INDEX i2(b), ALGORITHM= DEFAULT; ALTER TABLE t1 ADD INDEX i3(b), ALGORITHM= COPY; ALTER TABLE t1 ADD INDEX i4(b), ALGORITHM= INPLACE; -SET SESSION alter_algorithm= 0; --disable_info ALTER TABLE t1 DROP INDEX i1, DROP INDEX i2, DROP INDEX i3, DROP INDEX i4; @@ -2428,3 +2426,16 @@ DROP TABLE t; --echo # --echo # End of 10.7 tests --echo # + +--echo # +--echo # MDEV-33655 Remove alter_algorithm +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (a INT) ENGINE=MERGE, UNION(t1); +ALTER TABLE t2 COMMENT 'x', LOCK=SHARED; +DROP TABLE t2,t1; + +--echo # +--echo # End of 11.5 tests +--echo # diff --git a/mysql-test/main/ignored_index_innodb.result b/mysql-test/main/ignored_index_innodb.result index cc7af31ef97..0b0768c2683 100644 --- a/mysql-test/main/ignored_index_innodb.result +++ b/mysql-test/main/ignored_index_innodb.result @@ -1,7 +1,19 @@ create table t1 (a int, b int, key a1(a)) engine=innodb; insert into t1 values (1,1),(2,2),(3,3); -set alter_algorithm='instant'; -alter table t1 alter index a1 ignored; -alter table t1 alter index a1 not ignored; -set alter_algorithm=default; +alter table t1 alter index a1 ignored, algorithm=instant; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `a1` (`a`) IGNORED +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +alter table t1 alter index a1 not ignored, algorithm=instant; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + KEY `a1` (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci drop table t1; diff --git a/mysql-test/main/ignored_index_innodb.test b/mysql-test/main/ignored_index_innodb.test index c25cdc8d928..680c2a6cb01 100644 --- a/mysql-test/main/ignored_index_innodb.test +++ b/mysql-test/main/ignored_index_innodb.test @@ -6,11 +6,9 @@ create table t1 (a int, b int, key a1(a)) engine=innodb; insert into t1 values (1,1),(2,2),(3,3); -set alter_algorithm='instant'; -alter table t1 alter index a1 ignored; +alter table t1 alter index a1 ignored, algorithm=instant; +show create table t1; +alter table t1 alter index a1 not ignored, algorithm=instant; +show create table t1; -alter table t1 alter index a1 not ignored; - -set alter_algorithm=default; drop table t1; - diff --git a/mysql-test/main/innodb_mysql_sync.result b/mysql-test/main/innodb_mysql_sync.result index ef89d8a67e3..0b703b1d600 100644 --- a/mysql-test/main/innodb_mysql_sync.result +++ b/mysql-test/main/innodb_mysql_sync.result @@ -449,63 +449,14 @@ info: Records: 0 Duplicates: 0 Warnings: 0 ALTER TABLE t1 ENGINE=INNODB; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 -#ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE uses -#table copy when the alter_algorithm enabled. -SET SESSION alter_algorithm= TRUE; -affected rows: 0 -ALTER TABLE t1 FORCE; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 ENGINE= INNODB; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 -SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; -affected rows: 0 -#OPTIMIZE TABLE operation using table copy. -OPTIMIZE TABLE t1; -connection con1; -SET DEBUG_SYNC= 'now WAIT_FOR upgraded'; -affected rows: 0 -INSERT INTO t1 VALUES(10, 20); -affected rows: 1 -connection default; -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize status OK -affected rows: 2 -SET DEBUG_SYNC= 'RESET'; -affected rows: 0 -SET SESSION alter_algorithm= FALSE; -affected rows: 0 -#ALTER TABLE FORCE and ALTER TABLE ENGINE uses table copy -#when ALGORITHM COPY is used. +# ALTER TABLE FORCE and ALTER TABLE ENGINE uses table copy +# when ALGORITHM COPY is used. ALTER TABLE t1 FORCE, ALGORITHM= COPY; -affected rows: 2 -info: Records: 2 Duplicates: 0 Warnings: 0 +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 ALTER TABLE t1 ENGINE= INNODB, ALGORITHM= COPY; -affected rows: 2 -info: Records: 2 Duplicates: 0 Warnings: 0 -DROP TABLE t1; -#OPTIMIZE TABLE on a table with FULLTEXT index uses -#ALTER TABLE FORCE using COPY algorithm here. This -#test case ensures the COPY table debug sync point is hit. -SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; -#Setup a table with FULLTEXT index. -connection default; -CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1), FULLTEXT(fld1)) ENGINE= INNODB; -Warnings: -Note 1831 Duplicate index `fld1_2`. This is deprecated and will be disallowed in a future release -INSERT INTO t1 VALUES("String1"); -#OPTIMIZE TABLE operation. -OPTIMIZE TABLE t1; -connection con1; -SET DEBUG_SYNC= 'now WAIT_FOR upgraded'; -INSERT INTO t1 VALUES("String2"); -connection default; -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize status OK -SET DEBUG_SYNC= 'RESET'; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 DROP TABLE t1; #Test which demonstrates that ALTER TABLE, OPTIMIZE PARTITION #takes OPTIMIZE TABLE code path, hence does an online rebuild diff --git a/mysql-test/main/innodb_mysql_sync.test b/mysql-test/main/innodb_mysql_sync.test index 2c2fb733d44..1cd64affd38 100644 --- a/mysql-test/main/innodb_mysql_sync.test +++ b/mysql-test/main/innodb_mysql_sync.test @@ -611,27 +611,8 @@ INSERT INTO t1 VALUES(10, 20); ALTER TABLE t1 FORCE; ALTER TABLE t1 ENGINE=INNODB; ---echo #ALTER TABLE FORCE, ALTER TABLE ENGINE and OPTIMIZE TABLE uses ---echo #table copy when the alter_algorithm enabled. -SET SESSION alter_algorithm= TRUE; -ALTER TABLE t1 FORCE; -ALTER TABLE t1 ENGINE= INNODB; - -SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; ---echo #OPTIMIZE TABLE operation using table copy. ---send OPTIMIZE TABLE t1 - ---connection con1 -SET DEBUG_SYNC= 'now WAIT_FOR upgraded'; -INSERT INTO t1 VALUES(10, 20); - ---connection default ---reap -SET DEBUG_SYNC= 'RESET'; -SET SESSION alter_algorithm= FALSE; - ---echo #ALTER TABLE FORCE and ALTER TABLE ENGINE uses table copy ---echo #when ALGORITHM COPY is used. +--echo # ALTER TABLE FORCE and ALTER TABLE ENGINE uses table copy +--echo # when ALGORITHM COPY is used. ALTER TABLE t1 FORCE, ALGORITHM= COPY; ALTER TABLE t1 ENGINE= INNODB, ALGORITHM= COPY; --disable_info @@ -639,29 +620,6 @@ ALTER TABLE t1 ENGINE= INNODB, ALGORITHM= COPY; #cleanup DROP TABLE t1; ---echo #OPTIMIZE TABLE on a table with FULLTEXT index uses ---echo #ALTER TABLE FORCE using COPY algorithm here. This ---echo #test case ensures the COPY table debug sync point is hit. - -SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; - ---echo #Setup a table with FULLTEXT index. ---connection default -CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1), FULLTEXT(fld1)) ENGINE= INNODB; -INSERT INTO t1 VALUES("String1"); - ---echo #OPTIMIZE TABLE operation. ---send OPTIMIZE TABLE t1 - ---connection con1 -SET DEBUG_SYNC= 'now WAIT_FOR upgraded'; -INSERT INTO t1 VALUES("String2"); - ---connection default ---reap -SET DEBUG_SYNC= 'RESET'; -DROP TABLE t1; - --echo #Test which demonstrates that ALTER TABLE, OPTIMIZE PARTITION --echo #takes OPTIMIZE TABLE code path, hence does an online rebuild --echo #of the table with the patch. diff --git a/mysql-test/main/load_timezones_with_alter_algorithm_inplace.result b/mysql-test/main/load_timezones_with_alter_algorithm_inplace.result deleted file mode 100644 index 4992e7ed93b..00000000000 --- a/mysql-test/main/load_timezones_with_alter_algorithm_inplace.result +++ /dev/null @@ -1,18 +0,0 @@ -set global alter_algorithm=INPLACE; -RENAME TABLE mysql.time_zone TO mysql.time_zone_BACKUP; -RENAME TABLE mysql.time_zone_name TO mysql.time_zone_name_BACKUP; -RENAME TABLE mysql.time_zone_transition TO mysql.time_zone_transition_BACKUP; -RENAME TABLE mysql.time_zone_transition_type TO mysql.time_zone_transition_type_BACKUP; -CREATE TABLE mysql.time_zone LIKE mysql.time_zone_BACKUP; -CREATE TABLE mysql.time_zone_name LIKE mysql.time_zone_name_BACKUP; -CREATE TABLE mysql.time_zone_transition LIKE mysql.time_zone_transition_BACKUP; -CREATE TABLE mysql.time_zone_transition_type LIKE mysql.time_zone_transition_type_BACKUP; -DROP TABLE mysql.time_zone; -DROP TABLE mysql.time_zone_name; -DROP TABLE mysql.time_zone_transition; -DROP TABLE mysql.time_zone_transition_type; -RENAME TABLE mysql.time_zone_BACKUP TO mysql.time_zone; -RENAME TABLE mysql.time_zone_name_BACKUP TO mysql.time_zone_name; -RENAME TABLE mysql.time_zone_transition_BACKUP TO mysql.time_zone_transition; -RENAME TABLE mysql.time_zone_transition_type_BACKUP TO mysql.time_zone_transition_type; -set global alter_algorithm=DEFAULT; diff --git a/mysql-test/main/load_timezones_with_alter_algorithm_inplace.test b/mysql-test/main/load_timezones_with_alter_algorithm_inplace.test deleted file mode 100644 index 809f147fe04..00000000000 --- a/mysql-test/main/load_timezones_with_alter_algorithm_inplace.test +++ /dev/null @@ -1,40 +0,0 @@ ---source include/not_embedded.inc - -# MDEV-33044 Loading time zones does not work with alter_algorithm INPLACE - -set global alter_algorithm=INPLACE; - -# Because loading timezones alters the mysql tables, -# this test will leave mysql in a different state than when it started. -# Furthermore, checksums on the various mysql.timezone_x tables will fail. - -# Therefore we: -# 1. Make "backups" of the existing tables by renaming them -# 2. Make dummy clones of the tables we just backed up -# 3. Load timezones with alterations made to the dummy clone tables -# 4. Drop the newly made tables with changes made to them -# 5. Restore the backed up tables so the checksums will pass - -RENAME TABLE mysql.time_zone TO mysql.time_zone_BACKUP; -RENAME TABLE mysql.time_zone_name TO mysql.time_zone_name_BACKUP; -RENAME TABLE mysql.time_zone_transition TO mysql.time_zone_transition_BACKUP; -RENAME TABLE mysql.time_zone_transition_type TO mysql.time_zone_transition_type_BACKUP; - -CREATE TABLE mysql.time_zone LIKE mysql.time_zone_BACKUP; -CREATE TABLE mysql.time_zone_name LIKE mysql.time_zone_name_BACKUP; -CREATE TABLE mysql.time_zone_transition LIKE mysql.time_zone_transition_BACKUP; -CREATE TABLE mysql.time_zone_transition_type LIKE mysql.time_zone_transition_type_BACKUP; - ---exec $MYSQL_TZINFO_TO_SQL std_data/zoneinfo | $MYSQL mysql - -DROP TABLE mysql.time_zone; -DROP TABLE mysql.time_zone_name; -DROP TABLE mysql.time_zone_transition; -DROP TABLE mysql.time_zone_transition_type; - -RENAME TABLE mysql.time_zone_BACKUP TO mysql.time_zone; -RENAME TABLE mysql.time_zone_name_BACKUP TO mysql.time_zone_name; -RENAME TABLE mysql.time_zone_transition_BACKUP TO mysql.time_zone_transition; -RENAME TABLE mysql.time_zone_transition_type_BACKUP TO mysql.time_zone_transition_type; - -set global alter_algorithm=DEFAULT; diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result index 86ff8179b44..b1ce3dea284 100644 --- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result @@ -104,6 +104,10 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_n execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition ENGINE=', @time_zone_transition_engine, ', ORDER BY Time_zone_id, Transition_time'), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); SET session alter_algorithm=@old_alter_alg; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations SELECT COUNT(*) FROM time_zone; COUNT(*) 2 @@ -161,6 +165,10 @@ execute immediate if(@wsrep_cannot_replicate_tz, 'do 0','ALTER TABLE time_zone_t SET SESSION SQL_LOG_BIN=@save_sql_log_bin; execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); SET session alter_algorithm=@old_alter_alg; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations SELECT COUNT(*) FROM time_zone; COUNT(*) 2 @@ -481,6 +489,10 @@ execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0' # MDEV-29347 MariaDB 10.6.8 fails to start when ONLY_FULL_GROUP_BY gets provided # set sql_mode=only_full_group_by; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations SELECT COUNT(*) FROM time_zone; COUNT(*) 2 diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index dd89b55d651..24076c648dc 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -1972,169 +1972,6 @@ DROP USER 'user3'@'%'; update mysql.db set Delete_history_priv='Y' where db like 'test%'; drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; -# -# MDEV-16735 Upgrades only work if 'alter_algorithm' is 'DEFAULT' -# or 'COPY'. Test that the session value 'DEFAULT' in mysql_upgrade -# properly overrides the potentially incompatible global value. -# -SET GLOBAL alter_algorithm='INPLACE'; -SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm INPLACE -Phase 1/8: Checking and upgrading mysql database -Processing databases -mysql -mysql.column_stats OK -mysql.columns_priv OK -mysql.db OK -mysql.event OK -mysql.func OK -mysql.global_priv OK -mysql.gtid_slave_pos OK -mysql.help_category OK -mysql.help_keyword OK -mysql.help_relation OK -mysql.help_topic OK -mysql.index_stats OK -mysql.innodb_index_stats OK -mysql.innodb_table_stats OK -mysql.plugin OK -mysql.proc OK -mysql.procs_priv OK -mysql.proxies_priv OK -mysql.roles_mapping OK -mysql.servers OK -mysql.table_stats OK -mysql.tables_priv OK -mysql.time_zone OK -mysql.time_zone_leap_second OK -mysql.time_zone_name OK -mysql.time_zone_transition OK -mysql.time_zone_transition_type OK -mysql.transaction_registry OK -Phase 2/8: Installing used storage engines... Skipped -Phase 3/8: Running 'mysql_fix_privilege_tables' -Phase 4/8: Fixing views -mysql.user OK -sys.host_summary OK -sys.host_summary_by_file_io OK -sys.host_summary_by_file_io_type OK -sys.host_summary_by_stages OK -sys.host_summary_by_statement_latency OK -sys.host_summary_by_statement_type OK -sys.innodb_buffer_stats_by_schema OK -sys.innodb_buffer_stats_by_table OK -sys.innodb_lock_waits OK -sys.io_by_thread_by_latency OK -sys.io_global_by_file_by_bytes OK -sys.io_global_by_file_by_latency OK -sys.io_global_by_wait_by_bytes OK -sys.io_global_by_wait_by_latency OK -sys.latest_file_io OK -sys.memory_by_host_by_current_bytes OK -sys.memory_by_thread_by_current_bytes OK -sys.memory_by_user_by_current_bytes OK -sys.memory_global_by_current_bytes OK -sys.memory_global_total OK -sys.metrics OK -sys.privileges_by_table_by_level OK -sys.processlist OK -sys.ps_check_lost_instrumentation OK -sys.schema_auto_increment_columns OK -sys.schema_index_statistics OK -sys.schema_object_overview OK -sys.schema_redundant_indexes OK -sys.schema_table_lock_waits OK -sys.schema_table_statistics OK -sys.schema_table_statistics_with_buffer OK -sys.schema_tables_with_full_table_scans OK -sys.schema_unused_indexes OK -sys.session OK -sys.session_ssl_status OK -sys.statement_analysis OK -sys.statements_with_errors_or_warnings OK -sys.statements_with_full_table_scans OK -sys.statements_with_runtimes_in_95th_percentile OK -sys.statements_with_sorting OK -sys.statements_with_temp_tables OK -sys.user_summary OK -sys.user_summary_by_file_io OK -sys.user_summary_by_file_io_type OK -sys.user_summary_by_stages OK -sys.user_summary_by_statement_latency OK -sys.user_summary_by_statement_type OK -sys.version OK -sys.wait_classes_global_by_avg_latency OK -sys.wait_classes_global_by_latency OK -sys.waits_by_host_by_latency OK -sys.waits_by_user_by_latency OK -sys.waits_global_by_latency OK -sys.x$host_summary OK -sys.x$host_summary_by_file_io OK -sys.x$host_summary_by_file_io_type OK -sys.x$host_summary_by_stages OK -sys.x$host_summary_by_statement_latency OK -sys.x$host_summary_by_statement_type OK -sys.x$innodb_buffer_stats_by_schema OK -sys.x$innodb_buffer_stats_by_table OK -sys.x$innodb_lock_waits OK -sys.x$io_by_thread_by_latency OK -sys.x$io_global_by_file_by_bytes OK -sys.x$io_global_by_file_by_latency OK -sys.x$io_global_by_wait_by_bytes OK -sys.x$io_global_by_wait_by_latency OK -sys.x$latest_file_io OK -sys.x$memory_by_host_by_current_bytes OK -sys.x$memory_by_thread_by_current_bytes OK -sys.x$memory_by_user_by_current_bytes OK -sys.x$memory_global_by_current_bytes OK -sys.x$memory_global_total OK -sys.x$processlist OK -sys.x$ps_digest_95th_percentile_by_avg_us OK -sys.x$ps_digest_avg_latency_distribution OK -sys.x$ps_schema_table_statistics_io OK -sys.x$schema_flattened_keys OK -sys.x$schema_index_statistics OK -sys.x$schema_table_lock_waits OK -sys.x$schema_table_statistics OK -sys.x$schema_table_statistics_with_buffer OK -sys.x$schema_tables_with_full_table_scans OK -sys.x$session OK -sys.x$statement_analysis OK -sys.x$statements_with_errors_or_warnings OK -sys.x$statements_with_full_table_scans OK -sys.x$statements_with_runtimes_in_95th_percentile OK -sys.x$statements_with_sorting OK -sys.x$statements_with_temp_tables OK -sys.x$user_summary OK -sys.x$user_summary_by_file_io OK -sys.x$user_summary_by_file_io_type OK -sys.x$user_summary_by_stages OK -sys.x$user_summary_by_statement_latency OK -sys.x$user_summary_by_statement_type OK -sys.x$wait_classes_global_by_avg_latency OK -sys.x$wait_classes_global_by_latency OK -sys.x$waits_by_host_by_latency OK -sys.x$waits_by_user_by_latency OK -sys.x$waits_global_by_latency OK -Phase 5/8: Fixing table and database names -Phase 6/8: Checking and upgrading tables -Processing databases -information_schema -mtr -mtr.global_suppressions OK -mtr.test_suppressions OK -performance_schema -sys -sys.sys_config OK -test -Phase 7/8: uninstalling plugins -Phase 8/8: Running 'FLUSH PRIVILEGES' -OK -SET GLOBAL alter_algorithm=DEFAULT; -SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm DEFAULT # End of 10.3 tests # switching from mysql.global_priv to mysql.user drop view mysql.user_bak; diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index a17f1869141..7779373434a 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -405,19 +405,6 @@ update mysql.db set Delete_history_priv='Y' where db like 'test%'; drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; ---echo # ---echo # MDEV-16735 Upgrades only work if 'alter_algorithm' is 'DEFAULT' ---echo # or 'COPY'. Test that the session value 'DEFAULT' in mysql_upgrade ---echo # properly overrides the potentially incompatible global value. ---echo # - -SET GLOBAL alter_algorithm='INPLACE'; -SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; ---exec $MYSQL_UPGRADE --force 2>&1 -SET GLOBAL alter_algorithm=DEFAULT; -SHOW GLOBAL VARIABLES LIKE 'alter_algorithm'; ---remove_file $MYSQLD_DATADIR/mariadb_upgrade_info - --echo # End of 10.3 tests --source include/switch_to_mysql_user.inc diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index db4c0f0ab3a..8a5068aa57d 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -14,8 +14,8 @@ The following specify which files/extra groups are read (specified before remain function from any library, for example exit() from libc.so --alter-algorithm[=name] - Specify the alter table algorithm. One of: DEFAULT, COPY, - INPLACE, NOCOPY, INSTANT + Unused. One of: DEFAULT, COPY, INPLACE, NOCOPY, INSTANT. + Deprecated, will be removed in a future release. --analyze-sample-percentage=# Percentage of rows from the table ANALYZE TABLE will sample to collect table statistics. Set to 0 to let diff --git a/mysql-test/main/repair.result b/mysql-test/main/repair.result index 9e4cfa347a1..4d3fc09c0d0 100644 --- a/mysql-test/main/repair.result +++ b/mysql-test/main/repair.result @@ -1,4 +1,5 @@ call mtr.add_suppression("character set is multi-byte"); +call mtr.add_suppression("exists only for compatibility"); drop table if exists t1; create table t1 SELECT 1,"table 1"; repair table t1 use_frm; @@ -251,3 +252,40 @@ test.t1 repair status OK set myisam_repair_threads = default; drop table t1; # End of 10.2 tests +# +# MDEV-33737 The way of ignoring alter-algorithm is inconsistent with +# other options and with itself +# +select * from information_schema.system_variables where variable_name = 'ALTER_ALGORITHM'; +VARIABLE_NAME ALTER_ALGORITHM +SESSION_VALUE DEFAULT +GLOBAL_VALUE DEFAULT +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE DEFAULT +VARIABLE_SCOPE SESSION +VARIABLE_TYPE ENUM +VARIABLE_COMMENT Unused +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST DEFAULT,COPY,INPLACE,NOCOPY,INSTANT +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +GLOBAL_VALUE_PATH NULL +set alter_algorithm=COPY; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +select @@alter_algorithm; +@@alter_algorithm +DEFAULT +set statement alter_algorithm=COPY FOR SELECT @@alter_algorithm; +@@alter_algorithm +DEFAULT +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +# restart: --alter-algorithm=COPY +select @@alter_algorithm; +@@alter_algorithm +DEFAULT +# End of 11.5 tests diff --git a/mysql-test/main/repair.test b/mysql-test/main/repair.test index 45de1e73500..35a47420101 100644 --- a/mysql-test/main/repair.test +++ b/mysql-test/main/repair.test @@ -6,6 +6,7 @@ --source include/default_charset.inc call mtr.add_suppression("character set is multi-byte"); +call mtr.add_suppression("exists only for compatibility"); --disable_warnings drop table if exists t1; @@ -269,3 +270,21 @@ set myisam_repair_threads = default; drop table t1; --echo # End of 10.2 tests + +--echo # +--echo # MDEV-33737 The way of ignoring alter-algorithm is inconsistent with +--echo # other options and with itself +--echo # + +query_vertical select * from information_schema.system_variables where variable_name = 'ALTER_ALGORITHM'; + +set alter_algorithm=COPY; +select @@alter_algorithm; +set statement alter_algorithm=COPY FOR SELECT @@alter_algorithm; + +--let $restart_parameters= --alter-algorithm=COPY +--source include/restart_mysqld.inc + +select @@alter_algorithm; + +--echo # End of 11.5 tests diff --git a/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result index 9750c97a481..0888dd6ff5f 100644 --- a/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result +++ b/mysql-test/suite/galera/r/mariadb_tzinfo_to_sql.result @@ -20,6 +20,10 @@ SET @save_wsrep_mode=@@WSREP_MODE; # Apply on node_1 +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations 'binlog stationary as expected' SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; @wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN @@ -73,6 +77,10 @@ COUNT(*) connection node_1; SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM'; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations 'binlog stationary as expected' SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; @wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN @@ -128,6 +136,10 @@ COUNT(*) # Apply on node_1 connection node_1; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations 'binlog advanced as expected' SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; @wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN @@ -186,6 +198,10 @@ TRUNCATE TABLE time_zone_leap_second; connection node_1; SET GLOBAL WSREP_MODE=''; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations 'binlog advanced as expected' SELECT @wsrep_is_on, @wsrep_cannot_replicate_tz, @save_wsrep_on, @save_sql_log_bin, @@WSREP_ON, @@SQL_LOG_BIN; @wsrep_is_on @wsrep_cannot_replicate_tz @save_wsrep_on @save_sql_log_bin @@WSREP_ON @@SQL_LOG_BIN diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff deleted file mode 100644 index 6c0b1badcf8..00000000000 --- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff +++ /dev/null @@ -1,150 +0,0 @@ ---- alter_algorithm.result -+++ alter_algorithm.reject -@@ -7,40 +7,40 @@ - INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); - SELECT @@alter_algorithm; - @@alter_algorithm --COPY -+INPLACE - # All the following cases needs table rebuild - # Add and Drop primary key - ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Make existing column NULLABLE - ALTER TABLE t1 MODIFY f2 INT; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Drop Stored Column - ALTER TABLE t1 DROP COLUMN f5; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Add base non-generated column as a last column in the compressed table - ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Add base non-generated column but not in the last position - ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Force the table to rebuild - ALTER TABLE t1 FORCE; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Row format changes - ALTER TABLE t1 ROW_FORMAT=COMPRESSED; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Engine table - ALTER TABLE t1 ENGINE=INNODB; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; - affected rows: 0 - info: Records: 0 Duplicates: 0 Warnings: 0 -@@ -56,22 +56,22 @@ - FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; - INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); - ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - SET foreign_key_checks = 0; - affected rows: 0 - ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - DROP TABLE t2, t1; - affected rows: 0 - CREATE TABLE t1(f1 INT NOT NULL, -@@ -84,28 +84,27 @@ - INSERT INTO t1(f1, f2) VALUES(1, 1); - # Add column at the end of the table - ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Change virtual column expression - ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Add virtual column - ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Rename Column - ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Rename table - ALTER TABLE t1 RENAME t3; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 - # Drop Virtual Column - ALTER TABLE t3 DROP COLUMN vcol; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Column length varies - ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); - affected rows: 0 -@@ -113,12 +112,12 @@ - SET foreign_key_checks = 0; - affected rows: 0 - ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - SET foreign_key_checks = 1; - affected rows: 0 - ALTER TABLE t3 DROP FOREIGN KEY fidx; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - DROP TABLE t3, t2; - affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff deleted file mode 100644 index 6a09338dea2..00000000000 --- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff +++ /dev/null @@ -1,137 +0,0 @@ ---- alter_algorithm.result -+++ alter_algorithm.reject -@@ -7,40 +7,32 @@ - INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); - SELECT @@alter_algorithm; - @@alter_algorithm --COPY -+INSTANT - # All the following cases needs table rebuild - # Add and Drop primary key - ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Make existing column NULLABLE - ALTER TABLE t1 MODIFY f2 INT; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Drop Stored Column - ALTER TABLE t1 DROP COLUMN f5; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Add base non-generated column as a last column in the compressed table - ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Add base non-generated column but not in the last position - ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Force the table to rebuild - ALTER TABLE t1 FORCE; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Row format changes - ALTER TABLE t1 ROW_FORMAT=COMPRESSED; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Engine table - ALTER TABLE t1 ENGINE=INNODB; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; - affected rows: 0 - info: Records: 0 Duplicates: 0 Warnings: 0 -@@ -56,22 +48,17 @@ - FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; - INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); - ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY - ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY - ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY - ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY - SET foreign_key_checks = 0; - affected rows: 0 - ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY - DROP TABLE t2, t1; - affected rows: 0 - CREATE TABLE t1(f1 INT NOT NULL, -@@ -84,28 +71,27 @@ - INSERT INTO t1(f1, f2) VALUES(1, 1); - # Add column at the end of the table - ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Change virtual column expression - ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Add virtual column - ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Rename Column - ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Rename table - ALTER TABLE t1 RENAME t3; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 - # Drop Virtual Column - ALTER TABLE t3 DROP COLUMN vcol; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Column length varies - ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); - affected rows: 0 -@@ -113,12 +99,12 @@ - SET foreign_key_checks = 0; - affected rows: 0 - ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - SET foreign_key_checks = 1; - affected rows: 0 - ALTER TABLE t3 DROP FOREIGN KEY fidx; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - DROP TABLE t3, t2; - affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff deleted file mode 100644 index 317958638f1..00000000000 --- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff +++ /dev/null @@ -1,142 +0,0 @@ ---- alter_algorithm.result -+++ alter_algorithm.reject -@@ -7,40 +7,32 @@ - INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); - SELECT @@alter_algorithm; - @@alter_algorithm --COPY -+NOCOPY - # All the following cases needs table rebuild - # Add and Drop primary key - ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Make existing column NULLABLE - ALTER TABLE t1 MODIFY f2 INT; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Drop Stored Column - ALTER TABLE t1 DROP COLUMN f5; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Add base non-generated column as a last column in the compressed table - ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Add base non-generated column but not in the last position - ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Force the table to rebuild - ALTER TABLE t1 FORCE; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Row format changes - ALTER TABLE t1 ROW_FORMAT=COMPRESSED; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - # Engine table - ALTER TABLE t1 ENGINE=INNODB; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+Got one of the listed errors - ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; - affected rows: 0 - info: Records: 0 Duplicates: 0 Warnings: 0 -@@ -56,22 +48,22 @@ - FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; - INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); - ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - SET foreign_key_checks = 0; - affected rows: 0 - ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - DROP TABLE t2, t1; - affected rows: 0 - CREATE TABLE t1(f1 INT NOT NULL, -@@ -84,28 +76,27 @@ - INSERT INTO t1(f1, f2) VALUES(1, 1); - # Add column at the end of the table - ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Change virtual column expression - ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Add virtual column - ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Rename Column - ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Rename table - ALTER TABLE t1 RENAME t3; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 - # Drop Virtual Column - ALTER TABLE t3 DROP COLUMN vcol; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - # Column length varies - ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); - affected rows: 0 -@@ -113,12 +104,12 @@ - SET foreign_key_checks = 0; - affected rows: 0 - ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - SET foreign_key_checks = 1; - affected rows: 0 - ALTER TABLE t3 DROP FOREIGN KEY fidx; --affected rows: 1 --info: Records: 1 Duplicates: 0 Warnings: 0 -+affected rows: 0 -+info: Records: 0 Duplicates: 0 Warnings: 0 - DROP TABLE t3, t2; - affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result index 8d85aeb1921..055fb3ce688 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm.result +++ b/mysql-test/suite/innodb/r/alter_algorithm.result @@ -1,3 +1,6 @@ +# +# sql_mode: alter_algorithm: COPY +# CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT NULL, @@ -5,40 +8,37 @@ f4 INT as (f2) STORED, f5 INT as (f3) STORED, PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); -SELECT @@alter_algorithm; -@@alter_algorithm -COPY # All the following cases needs table rebuild # Add and Drop primary key -ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); +ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Make existing column NULLABLE -ALTER TABLE t1 MODIFY f2 INT; +ALTER TABLE t1 MODIFY f2 INT, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Drop Stored Column -ALTER TABLE t1 DROP COLUMN f5; +ALTER TABLE t1 DROP COLUMN f5, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Add base non-generated column as a last column in the compressed table -ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; +ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Add base non-generated column but not in the last position -ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; +ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Force the table to rebuild -ALTER TABLE t1 FORCE; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Row format changes -ALTER TABLE t1 ROW_FORMAT=COMPRESSED; +ALTER TABLE t1 ROW_FORMAT=COMPRESSED, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Engine table -ALTER TABLE t1 ENGINE=INNODB; +ALTER TABLE t1 ENGINE=INNODB, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; @@ -55,21 +55,21 @@ CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, INDEX(f1), FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); -ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; +ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; +ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); +ALTER TABLE t1 ADD UNIQUE INDEX u1(f2), ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 -ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; +ALTER TABLE t1 DROP INDEX f4, page_compression_level=9, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 SET foreign_key_checks = 0; affected rows: 0 -ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); +ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1), ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 DROP TABLE t2, t1; @@ -83,42 +83,390 @@ f3 VARCHAR(10), INDEX(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table -ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; +ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL', ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Change virtual column expression -ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; +ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Add virtual column -ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; +ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Rename Column -ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; +ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Rename table -ALTER TABLE t1 RENAME t3; +ALTER TABLE t1 RENAME t3, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Drop Virtual Column -ALTER TABLE t3 DROP COLUMN vcol; +ALTER TABLE t3 DROP COLUMN vcol, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Column length varies -ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); +ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20), ALGORITHM=COPY; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 SET foreign_key_checks = 0; affected rows: 0 -ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); +ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1), ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 SET foreign_key_checks = 1; affected rows: 0 -ALTER TABLE t3 DROP FOREIGN KEY fidx; +ALTER TABLE t3 DROP FOREIGN KEY fidx, ALGORITHM=COPY; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 DROP TABLE t3, t2; affected rows: 0 +# +# sql_mode: alter_algorithm: INPLACE +# +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT NULL, +f4 INT as (f2) STORED, +f5 INT as (f3) STORED, +PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); +# All the following cases needs table rebuild +# Add and Drop primary key +ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Make existing column NULLABLE +ALTER TABLE t1 MODIFY f2 INT, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Drop Stored Column +ALTER TABLE t1 DROP COLUMN f5, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Add base non-generated column as a last column in the compressed table +ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Add base non-generated column but not in the last position +ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Force the table to rebuild +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Row format changes +ALTER TABLE t1 ROW_FORMAT=COMPRESSED, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Engine table +ALTER TABLE t1 ENGINE=INNODB, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +affected rows: 0 +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +f4 INT NOT NULL UNIQUE, +f5 INT NOT NULL, +INDEX idx(f2))ENGINE=INNODB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1), +FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); +ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD UNIQUE INDEX u1(f2), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP INDEX f4, page_compression_level=9, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t2, t1; +affected rows: 0 +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +INDEX idx (f2))engine=innodb; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +f3 VARCHAR(10), +INDEX(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2) VALUES(1, 1); +# Add column at the end of the table +ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL', ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Change virtual column expression +ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Add virtual column +ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Rename Column +ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Rename table +ALTER TABLE t1 RENAME t3, ALGORITHM=INPLACE; +affected rows: 0 +# Drop Virtual Column +ALTER TABLE t3 DROP COLUMN vcol, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Column length varies +ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 1; +affected rows: 0 +ALTER TABLE t3 DROP FOREIGN KEY fidx, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t3, t2; +affected rows: 0 +# +# sql_mode: alter_algorithm: NOCOPY +# +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT NULL, +f4 INT as (f2) STORED, +f5 INT as (f3) STORED, +PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); +# All the following cases needs table rebuild +# Add and Drop primary key +ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=NOCOPY; +Got one of the listed errors +# Make existing column NULLABLE +ALTER TABLE t1 MODIFY f2 INT, ALGORITHM=NOCOPY; +Got one of the listed errors +# Drop Stored Column +ALTER TABLE t1 DROP COLUMN f5, ALGORITHM=NOCOPY; +Got one of the listed errors +# Add base non-generated column as a last column in the compressed table +ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL, ALGORITHM=NOCOPY; +Got one of the listed errors +# Add base non-generated column but not in the last position +ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3, ALGORITHM=NOCOPY; +Got one of the listed errors +# Force the table to rebuild +ALTER TABLE t1 FORCE, ALGORITHM=NOCOPY; +Got one of the listed errors +# Row format changes +ALTER TABLE t1 ROW_FORMAT=COMPRESSED, ALGORITHM=NOCOPY; +Got one of the listed errors +# Engine table +ALTER TABLE t1 ENGINE=INNODB, ALGORITHM=NOCOPY; +Got one of the listed errors +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +affected rows: 0 +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +f4 INT NOT NULL UNIQUE, +f5 INT NOT NULL, +INDEX idx(f2))ENGINE=INNODB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1), +FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); +ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 ADD UNIQUE INDEX u1(f2), ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 DROP INDEX f4, page_compression_level=9, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1), ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t2, t1; +affected rows: 0 +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +INDEX idx (f2))engine=innodb; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +f3 VARCHAR(10), +INDEX(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2) VALUES(1, 1); +# Add column at the end of the table +ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL', ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Change virtual column expression +ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Add virtual column +ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Rename Column +ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Rename table +ALTER TABLE t1 RENAME t3, ALGORITHM=NOCOPY; +affected rows: 0 +# Drop Virtual Column +ALTER TABLE t3 DROP COLUMN vcol, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Column length varies +ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20), ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1), ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 1; +affected rows: 0 +ALTER TABLE t3 DROP FOREIGN KEY fidx, ALGORITHM=NOCOPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t3, t2; +affected rows: 0 +# +# sql_mode: alter_algorithm: INSTANT +# +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT NULL, +f4 INT as (f2) STORED, +f5 INT as (f3) STORED, +PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); +# All the following cases needs table rebuild +# Add and Drop primary key +ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=INSTANT; +Got one of the listed errors +# Make existing column NULLABLE +ALTER TABLE t1 MODIFY f2 INT, ALGORITHM=INSTANT; +Got one of the listed errors +# Drop Stored Column +ALTER TABLE t1 DROP COLUMN f5, ALGORITHM=INSTANT; +Got one of the listed errors +# Add base non-generated column as a last column in the compressed table +ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL, ALGORITHM=INSTANT; +Got one of the listed errors +# Add base non-generated column but not in the last position +ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3, ALGORITHM=INSTANT; +Got one of the listed errors +# Force the table to rebuild +ALTER TABLE t1 FORCE, ALGORITHM=INSTANT; +Got one of the listed errors +# Row format changes +ALTER TABLE t1 ROW_FORMAT=COMPRESSED, ALGORITHM=INSTANT; +Got one of the listed errors +# Engine table +ALTER TABLE t1 ENGINE=INNODB, ALGORITHM=INSTANT; +Got one of the listed errors +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +affected rows: 0 +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +f4 INT NOT NULL UNIQUE, +f5 INT NOT NULL, +INDEX idx(f2))ENGINE=INNODB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1), +FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); +ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY +ALTER TABLE t1 ADD UNIQUE INDEX u1(f2), ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +ALTER TABLE t1 DROP INDEX f4, page_compression_level=9, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1), ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY +DROP TABLE t2, t1; +affected rows: 0 +CREATE TABLE t1(f1 INT NOT NULL, +f2 INT NOT NULL, +f3 INT AS (f2 * f2) VIRTUAL, +INDEX idx (f2))engine=innodb; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +f3 VARCHAR(10), +INDEX(f1))ENGINE=INNODB; +INSERT INTO t1(f1, f2) VALUES(1, 1); +# Add column at the end of the table +ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL', ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Change virtual column expression +ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Add virtual column +ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Rename Column +ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Rename table +ALTER TABLE t1 RENAME t3, ALGORITHM=INSTANT; +affected rows: 0 +# Drop Virtual Column +ALTER TABLE t3 DROP COLUMN vcol, ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +# Column length varies +ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20), ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 0; +affected rows: 0 +ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1), ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SET foreign_key_checks = 1; +affected rows: 0 +ALTER TABLE t3 DROP FOREIGN KEY fidx, ALGORITHM=INSTANT; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t3, t2; +affected rows: 0 diff --git a/mysql-test/suite/innodb/r/alter_algorithm2.result b/mysql-test/suite/innodb/r/alter_algorithm2.result index f4443c80c77..f8c3eaa6ccc 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm2.result +++ b/mysql-test/suite/innodb/r/alter_algorithm2.result @@ -1,7 +1,5 @@ CREATE TABLE t1 (a INT)ENGINE=InnoDB; INSERT INTO t1 VALUES(1); -SET alter_algorithm='INPLACE'; -affected rows: 0 PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)'; affected rows: 0 info: Statement prepared @@ -18,20 +16,6 @@ BEGIN ALTER TABLE t1 DROP KEY idx2; END| affected rows: 0 -SET alter_algorithm='COPY'; -affected rows: 0 -EXECUTE stmt; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 -EXECUTE stmt1; -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 -call p1(); -affected rows: 1 -call p2(); -affected rows: 1 -SET alter_algorithm='NOCOPY'; -affected rows: 0 EXECUTE stmt; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 @@ -42,12 +26,6 @@ call p1(); affected rows: 0 call p2(); affected rows: 0 -SET alter_algorithm='INSTANT'; -affected rows: 0 -EXECUTE stmt; -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY -call p1(); -ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY DROP TABLE t1; affected rows: 0 DROP PROCEDURE p1; @@ -64,9 +42,7 @@ affected rows: 0 INSERT INTO t1 VALUES(1,1),(2,2),(3,3); affected rows: 3 info: Records: 3 Duplicates: 0 Warnings: 0 -SET ALTER_ALGORITHM=INSTANT; -affected rows: 0 -ALTER TABLE t1 DROP COLUMN col1; +ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY; ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE diff --git a/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff deleted file mode 100644 index 7c32d38a1d9..00000000000 --- a/mysql-test/suite/innodb/r/alter_not_null,COPY,NON-STRICT.rdiff +++ /dev/null @@ -1,79 +0,0 @@ ---- alter_not_null.result -+++ alter_not_null,COPY,NON-STRICT.result~ -@@ -4,8 +4,8 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'f1' at row 1 - SELECT * FROM t1; -@@ -18,8 +18,8 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'f1' at row 1 - SELECT * FROM t1; -@@ -32,8 +32,8 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'f1' at row 1 - SELECT * FROM t1; -@@ -46,8 +46,8 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'f1' at row 1 - SELECT * FROM t1; -@@ -60,8 +60,8 @@ - f1 f2 f3 - 2 2 NULL - ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'f3' at row 1 - SELECT * FROM t1; -@@ -74,8 +74,8 @@ - f1 b - 10 NULL - ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'b' at row 1 - SELECT * FROM t1; -@@ -95,8 +95,8 @@ - CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; - INSERT INTO t1 VALUES(1, NULL); - ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'c2' at row 1 - SELECT * FROM t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff deleted file mode 100644 index 37e97169a11..00000000000 --- a/mysql-test/suite/innodb/r/alter_not_null,COPY,STRICT.rdiff +++ /dev/null @@ -1,109 +0,0 @@ ---- alter_not_null.result -+++ alter_not_null,COPY,STRICT.result~ -@@ -4,13 +4,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 --0 -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; - INSERT INTO t1 VALUES(NULL); -@@ -18,13 +15,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 -- -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; - INSERT INTO t1 VALUES(NULL); -@@ -32,13 +26,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 -- -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; - INSERT INTO t1 VALUES(NULL); -@@ -46,13 +37,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 -- -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; - INSERT INTO t1 VALUES(2, 2, NULL); -@@ -60,13 +48,10 @@ - f1 f2 f3 - 2 2 NULL - ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f3' at row 1 -+ERROR 01000: Data truncated for column 'f3' at row 1 - SELECT * FROM t1; - f1 f2 f3 --2 2 0 -+2 2 NULL - DROP TABLE t1; - CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; - INSERT INTO t1 VALUES(10, NULL); -@@ -74,13 +59,10 @@ - f1 b - 10 NULL - ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'b' at row 1 -+ERROR 01000: Data truncated for column 'b' at row 1 - SELECT * FROM t1; - f1 b --10 0 -+10 NULL - DROP TABLE t1; - CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; - ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; -@@ -95,8 +77,8 @@ - CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; - INSERT INTO t1 VALUES(1, NULL); - ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 -+affected rows: 1 -+info: Records: 1 Duplicates: 0 Warnings: 1 - Warnings: - Warning 1265 Data truncated for column 'c2' at row 1 - SELECT * FROM t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff b/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff deleted file mode 100644 index 555f4cdb1df..00000000000 --- a/mysql-test/suite/innodb/r/alter_not_null,INPLACE,STRICT.rdiff +++ /dev/null @@ -1,98 +0,0 @@ ---- alter_not_null.result -+++ alter_not_null,INPLACE,STRICT.result~ -@@ -4,13 +4,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 --0 -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; - INSERT INTO t1 VALUES(NULL); -@@ -18,13 +15,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 -- -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; - INSERT INTO t1 VALUES(NULL); -@@ -32,13 +26,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 -- -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; - INSERT INTO t1 VALUES(NULL); -@@ -46,13 +37,10 @@ - f1 - NULL - ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f1' at row 1 -+ERROR 01000: Data truncated for column 'f1' at row 1 - SELECT * FROM t1; - f1 -- -+NULL - DROP TABLE t1; - CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; - INSERT INTO t1 VALUES(2, 2, NULL); -@@ -60,13 +48,10 @@ - f1 f2 f3 - 2 2 NULL - ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'f3' at row 1 -+ERROR 01000: Data truncated for column 'f3' at row 1 - SELECT * FROM t1; - f1 f2 f3 --2 2 0 -+2 2 NULL - DROP TABLE t1; - CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; - INSERT INTO t1 VALUES(10, NULL); -@@ -74,13 +59,10 @@ - f1 b - 10 NULL - ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); --affected rows: 0 --info: Records: 0 Duplicates: 0 Warnings: 1 --Warnings: --Warning 1265 Data truncated for column 'b' at row 1 -+ERROR 01000: Data truncated for column 'b' at row 1 - SELECT * FROM t1; - f1 b --10 0 -+10 NULL - DROP TABLE t1; - CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; - ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; diff --git a/mysql-test/suite/innodb/r/alter_not_null,STRICT.result b/mysql-test/suite/innodb/r/alter_not_null,STRICT.result new file mode 100644 index 00000000000..70ea454bdd6 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_not_null,STRICT.result @@ -0,0 +1,198 @@ +# +# sql_mode: STRICT_TRANS_TABLES alter_algorithm: COPY +# +CREATE TABLE t1(f1 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL, ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL, ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc', ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(2, 2, NULL); +SELECT * FROM t1; +f1 f2 f3 +2 2 NULL +ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'f3' at row 1 +SELECT * FROM t1; +f1 f2 f3 +2 2 NULL +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(10, NULL); +SELECT * FROM t1; +f1 b +10 NULL +ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), ALGORITHM=COPY; +ERROR 01000: Data truncated for column 'b' at row 1 +SELECT * FROM t1; +f1 b +10 NULL +DROP TABLE t1; +CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=COPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, NULL); +ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c2' at row 1 +SELECT * FROM t1; +c1 c2 +1 0 +DROP TABLE t1; +# +# MDEV-16126 Crash or ASAN heap-buffer-overflow in +# mach_read_from_n_little_endian upon ALTER TABLE with blob +# +CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY(b), ALGORITHM=COPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +# +# sql_mode: STRICT_TRANS_TABLES alter_algorithm: INPLACE +# +CREATE TABLE t1(f1 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL, ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL, ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc', ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +NULL +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(2, 2, NULL); +SELECT * FROM t1; +f1 f2 f3 +2 2 NULL +ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'f3' at row 1 +SELECT * FROM t1; +f1 f2 f3 +2 2 NULL +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(10, NULL); +SELECT * FROM t1; +f1 b +10 NULL +ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), ALGORITHM=INPLACE; +ERROR 01000: Data truncated for column 'b' at row 1 +SELECT * FROM t1; +f1 b +10 NULL +DROP TABLE t1; +CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, NULL); +ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c2' at row 1 +SELECT * FROM t1; +c1 c2 +1 0 +DROP TABLE t1; +# +# MDEV-16126 Crash or ASAN heap-buffer-overflow in +# mach_read_from_n_little_endian upon ALTER TABLE with blob +# +CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY(b), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/alter_not_null.result b/mysql-test/suite/innodb/r/alter_not_null.result index 688493351b8..e67e86f9b8f 100644 --- a/mysql-test/suite/innodb/r/alter_not_null.result +++ b/mysql-test/suite/innodb/r/alter_not_null.result @@ -1,11 +1,14 @@ +# +# sql_mode: alter_algorithm: COPY +# CREATE TABLE t1(f1 INT)ENGINE=INNODB; INSERT INTO t1 VALUES(NULL); SELECT * FROM t1; f1 NULL -ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'f1' at row 1 SELECT * FROM t1; @@ -17,9 +20,9 @@ INSERT INTO t1 VALUES(NULL); SELECT * FROM t1; f1 NULL -ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL, ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'f1' at row 1 SELECT * FROM t1; @@ -31,9 +34,9 @@ INSERT INTO t1 VALUES(NULL); SELECT * FROM t1; f1 NULL -ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL, ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'f1' at row 1 SELECT * FROM t1; @@ -45,9 +48,9 @@ INSERT INTO t1 VALUES(NULL); SELECT * FROM t1; f1 NULL -ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc', ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'f1' at row 1 SELECT * FROM t1; @@ -59,9 +62,9 @@ INSERT INTO t1 VALUES(2, 2, NULL); SELECT * FROM t1; f1 f2 f3 2 2 NULL -ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'f3' at row 1 SELECT * FROM t1; @@ -73,9 +76,9 @@ INSERT INTO t1 VALUES(10, NULL); SELECT * FROM t1; f1 b 10 NULL -ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 1 +ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), ALGORITHM=COPY; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 1 Warnings: Warning 1265 Data truncated for column 'b' at row 1 SELECT * FROM t1; @@ -83,12 +86,12 @@ f1 b 10 0 DROP TABLE t1; CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; -ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; +ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=COPY; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; -ALTER TABLE t1 FORCE; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; @@ -108,7 +111,124 @@ DROP TABLE t1; # mach_read_from_n_little_endian upon ALTER TABLE with blob # CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; -ALTER TABLE t1 ADD PRIMARY KEY(b); +ALTER TABLE t1 ADD PRIMARY KEY(b), ALGORITHM=COPY; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +# +# sql_mode: alter_algorithm: INPLACE +# +CREATE TABLE t1(f1 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 +0 +DROP TABLE t1; +CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 + +DROP TABLE t1; +CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 + +DROP TABLE t1; +CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +f1 +NULL +ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc', ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f1' at row 1 +SELECT * FROM t1; +f1 + +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(2, 2, NULL); +SELECT * FROM t1; +f1 f2 f3 +2 2 NULL +ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'f3' at row 1 +SELECT * FROM t1; +f1 f2 f3 +2 2 0 +DROP TABLE t1; +CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(10, NULL); +SELECT * FROM t1; +f1 b +10 NULL +ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'b' at row 1 +SELECT * FROM t1; +f1 b +10 0 +DROP TABLE t1; +CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; +ALTER TABLE t1 FORCE, ALGORITHM=INPLACE; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, NULL); +ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 1 +Warnings: +Warning 1265 Data truncated for column 'c2' at row 1 +SELECT * FROM t1; +c1 c2 +1 0 +DROP TABLE t1; +# +# MDEV-16126 Crash or ASAN heap-buffer-overflow in +# mach_read_from_n_little_endian upon ALTER TABLE with blob +# +CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; +ALTER TABLE t1 ADD PRIMARY KEY(b), ALGORITHM=INPLACE; affected rows: 0 info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb_bug53592.result b/mysql-test/suite/innodb/r/innodb_bug53592.result index 1d5b0f3198a..a4e49e61eee 100644 --- a/mysql-test/suite/innodb/r/innodb_bug53592.result +++ b/mysql-test/suite/innodb/r/innodb_bug53592.result @@ -1,18 +1,3 @@ -set alter_algorithm=0; -create table bug53592(a int) engine=innodb row_format=compact; -alter table bug53592 add column b text charset utf8; -alter table bug53592 add column c blob not null; -create index bug53592_b on bug53592(b(81)); -create unique index bug53592_c on bug53592(c(1)); -set statement sql_mode = '' for -replace into bug53592 values (),(); -Warnings: -Warning 1364 Field 'c' doesn't have a default value -check table bug53592; -Table Op Msg_type Msg_text -test.bug53592 check status OK -drop table bug53592; -set alter_algorithm=1; create table bug53592(a int) engine=innodb row_format=compact; alter table bug53592 add column b text charset utf8; alter table bug53592 add column c blob not null; diff --git a/mysql-test/suite/innodb/t/alter_algorithm-master.opt b/mysql-test/suite/innodb/t/alter_algorithm-master.opt new file mode 100644 index 00000000000..6f3e0172757 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_algorithm-master.opt @@ -0,0 +1 @@ +--skip-innodb-read-only-compressed diff --git a/mysql-test/suite/innodb/t/alter_algorithm.combinations b/mysql-test/suite/innodb/t/alter_algorithm.combinations deleted file mode 100644 index af644d65ec5..00000000000 --- a/mysql-test/suite/innodb/t/alter_algorithm.combinations +++ /dev/null @@ -1,15 +0,0 @@ -[COPY] ---alter_algorithm=copy ---skip-innodb-read-only-compressed - -[INPLACE] ---alter_algorithm=inplace ---skip-innodb-read-only-compressed - -[NOCOPY] ---alter_algorithm=nocopy ---skip-innodb-read-only-compressed - -[INSTANT] ---alter_algorithm=instant ---skip-innodb-read-only-compressed diff --git a/mysql-test/suite/innodb/t/alter_algorithm.inc b/mysql-test/suite/innodb/t/alter_algorithm.inc index 1aa3caf7d66..ba1d449a182 100644 --- a/mysql-test/suite/innodb/t/alter_algorithm.inc +++ b/mysql-test/suite/innodb/t/alter_algorithm.inc @@ -1,2 +1,144 @@ -# See also alter_algorithm.combinations ---source include/have_innodb.inc +let $algorithm = $alter_algorithm; +let $error_code = 0; + +--echo # +--echo # sql_mode: $sql_mode alter_algorithm: $alter_algorithm +--echo # + +if ($algorithm == "NOCOPY") { + let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON; +} + +if ($algorithm == "INSTANT") { + let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON; +} + +CREATE TABLE t1(f1 INT NOT NULL, + f2 INT NOT NULL, + f3 INT NULL, + f4 INT as (f2) STORED, + f5 INT as (f3) STORED, + PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); + +--enable_info +--echo # All the following cases needs table rebuild + +--echo # Add and Drop primary key +--error $error_code +--eval ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1), ALGORITHM=$alter_algorithm + +--echo # Make existing column NULLABLE +--error $error_code +--eval ALTER TABLE t1 MODIFY f2 INT, ALGORITHM=$alter_algorithm + +--echo # Drop Stored Column +--error $error_code +--eval ALTER TABLE t1 DROP COLUMN f5, ALGORITHM=$alter_algorithm + +--echo # Add base non-generated column as a last column in the compressed table +--error $error_code +--eval ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL, ALGORITHM=$alter_algorithm + +--echo # Add base non-generated column but not in the last position +--error $error_code +--eval ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3, ALGORITHM=$alter_algorithm + +--echo # Force the table to rebuild +--error $error_code +--eval ALTER TABLE t1 FORCE, ALGORITHM=$alter_algorithm + +--echo # Row format changes +--error $error_code +--eval ALTER TABLE t1 ROW_FORMAT=COMPRESSED, ALGORITHM=$alter_algorithm + +--echo # Engine table +--error $error_code +--eval ALTER TABLE t1 ENGINE=INNODB, ALGORITHM=$alter_algorithm + +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; + +DROP TABLE t1; +--disable_info + +if ($algorithm == "NOCOPY") { + let $error_code = 0; +} + +if ($algorithm == "INSTANT") { + let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED_REASON; +} + +CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, + f3 INT AS (f2 * f2) VIRTUAL, + f4 INT NOT NULL UNIQUE, + f5 INT NOT NULL, + INDEX idx(f2))ENGINE=INNODB; + +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1), + FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; + +INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); + +--enable_info +--error $error_code +--eval ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1, ALGORITHM=$alter_algorithm + +--error $error_code +--eval ALTER TABLE t1 DROP INDEX idx, page_compression_level=5, ALGORITHM=$alter_algorithm + +--error $error_code +--eval ALTER TABLE t1 ADD UNIQUE INDEX u1(f2), ALGORITHM=$alter_algorithm + +--error $error_code +--eval ALTER TABLE t1 DROP INDEX f4, page_compression_level=9, ALGORITHM=$alter_algorithm + +SET foreign_key_checks = 0; +--error $error_code +--eval ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1), ALGORITHM=$alter_algorithm + +DROP TABLE t2, t1; +--disable_info + +CREATE TABLE t1(f1 INT NOT NULL, + f2 INT NOT NULL, + f3 INT AS (f2 * f2) VIRTUAL, + INDEX idx (f2))engine=innodb; + +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, + f3 VARCHAR(10), + INDEX(f1))ENGINE=INNODB; + +INSERT INTO t1(f1, f2) VALUES(1, 1); + +--enable_info +--echo # Add column at the end of the table +--eval ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL', ALGORITHM=$alter_algorithm + +--echo # Change virtual column expression +--eval ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL, ALGORITHM=$alter_algorithm + +--echo # Add virtual column +--eval ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL, ALGORITHM=$alter_algorithm + +--echo # Rename Column +--eval ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL, ALGORITHM=$alter_algorithm + +--echo # Rename table +--eval ALTER TABLE t1 RENAME t3, ALGORITHM=$alter_algorithm + +--echo # Drop Virtual Column +--eval ALTER TABLE t3 DROP COLUMN vcol, ALGORITHM=$alter_algorithm + +--echo # Column length varies +--eval ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20), ALGORITHM=$alter_algorithm + +SET foreign_key_checks = 0; +--eval ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1), ALGORITHM=$alter_algorithm + +SET foreign_key_checks = 1; +--eval ALTER TABLE t3 DROP FOREIGN KEY fidx, ALGORITHM=$alter_algorithm + +DROP TABLE t3, t2; +--disable_info diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test index 08c23b505f3..ed5fb3649a2 100644 --- a/mysql-test/suite/innodb/t/alter_algorithm.test +++ b/mysql-test/suite/innodb/t/alter_algorithm.test @@ -1,145 +1,10 @@ --source include/have_innodb.inc -let $algorithm = `SELECT @@ALTER_ALGORITHM`; -let $error_code = 0; -if ($algorithm == "NOCOPY") { - let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON; -} - -if ($algorithm == "INSTANT") { - let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED, ER_ALTER_OPERATION_NOT_SUPPORTED_REASON; -} - -CREATE TABLE t1(f1 INT NOT NULL, - f2 INT NOT NULL, - f3 INT NULL, - f4 INT as (f2) STORED, - f5 INT as (f3) STORED, - PRIMARY KEY(f1))ROW_FORMAT=COMPRESSED, ENGINE=INNODB; -INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); - -SELECT @@alter_algorithm; - ---enable_info ---echo # All the following cases needs table rebuild - ---echo # Add and Drop primary key ---error $error_code -ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col1); - ---echo # Make existing column NULLABLE ---error $error_code -ALTER TABLE t1 MODIFY f2 INT; - ---echo # Drop Stored Column ---error $error_code -ALTER TABLE t1 DROP COLUMN f5; - ---echo # Add base non-generated column as a last column in the compressed table ---error $error_code -ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; - ---echo # Add base non-generated column but not in the last position ---error $error_code -ALTER TABLE t1 ADD COLUMN f7 INT NOT NULL after f3; - ---echo # Force the table to rebuild ---error $error_code -ALTER TABLE t1 FORCE; - ---echo # Row format changes ---error $error_code -ALTER TABLE t1 ROW_FORMAT=COMPRESSED; - ---echo # Engine table ---error $error_code -ALTER TABLE t1 ENGINE=INNODB; - -# Irrespective of alter_algorithm value, the following command -# should succeed because of explicitly mentioning ALGORTHM=DEFAULT -ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; - -DROP TABLE t1; ---disable_info - -if ($algorithm == "NOCOPY") { - let $error_code = 0; -} - -if ($algorithm == "INSTANT") { - let $error_code = ER_ALTER_OPERATION_NOT_SUPPORTED_REASON; -} - -CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, - f3 INT AS (f2 * f2) VIRTUAL, - f4 INT NOT NULL UNIQUE, - f5 INT NOT NULL, - INDEX idx(f2))ENGINE=INNODB; - -CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, - INDEX(f1), - FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; - -INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); - ---enable_info ---error $error_code -ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; - ---error $error_code -ALTER TABLE t1 DROP INDEX idx, page_compression_level=5; - ---error $error_code -ALTER TABLE t1 ADD UNIQUE INDEX u1(f2); - ---error $error_code -ALTER TABLE t1 DROP INDEX f4, page_compression_level=9; - -SET foreign_key_checks = 0; ---error $error_code -ALTER TABLE t1 ADD FOREIGN KEY(f5) REFERENCES t2(f1); - -DROP TABLE t2, t1; ---disable_info - -CREATE TABLE t1(f1 INT NOT NULL, - f2 INT NOT NULL, - f3 INT AS (f2 * f2) VIRTUAL, - INDEX idx (f2))engine=innodb; - -CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, - f3 VARCHAR(10), - INDEX(f1))ENGINE=INNODB; - -INSERT INTO t1(f1, f2) VALUES(1, 1); - ---enable_info ---echo # Add column at the end of the table -ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; - ---echo # Change virtual column expression -ALTER TABLE t1 CHANGE f3 f3 INT AS (f2 * f2) VIRTUAL; - ---echo # Add virtual column -ALTER TABLE t1 ADD COLUMN f5 INT AS (f2) VIRTUAL; - ---echo # Rename Column -ALTER TABLE t1 CHANGE f3 vcol INT AS (f2) VIRTUAL; - ---echo # Rename table -ALTER TABLE t1 RENAME t3; - ---echo # Drop Virtual Column -ALTER TABLE t3 DROP COLUMN vcol; - ---echo # Column length varies -ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); - -SET foreign_key_checks = 0; -ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); - -SET foreign_key_checks = 1; -ALTER TABLE t3 DROP FOREIGN KEY fidx; - -DROP TABLE t3, t2; ---disable_info +let $alter_algorithm=COPY; +--source alter_algorithm.inc +let $alter_algorithm=INPLACE; +--source alter_algorithm.inc +let $alter_algorithm=NOCOPY; +--source alter_algorithm.inc +let $alter_algorithm=INSTANT; +--source alter_algorithm.inc diff --git a/mysql-test/suite/innodb/t/alter_algorithm2.test b/mysql-test/suite/innodb/t/alter_algorithm2.test index cdece2398f0..48335f123e0 100644 --- a/mysql-test/suite/innodb/t/alter_algorithm2.test +++ b/mysql-test/suite/innodb/t/alter_algorithm2.test @@ -2,13 +2,7 @@ CREATE TABLE t1 (a INT)ENGINE=InnoDB; INSERT INTO t1 VALUES(1); -# alter_algorithm variable doesn't affect when ALTER stmt -# during PREPARE PHASE or CREATE PROCEDURE -# Only when execution/call happens, alter uses the alter_algorithm -# variable when user does not mention algorithm explicitly. - --enable_info -SET alter_algorithm='INPLACE'; PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)'; PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx'; DELIMITER |; @@ -23,24 +17,11 @@ BEGIN END| DELIMITER ;| -SET alter_algorithm='COPY'; EXECUTE stmt; EXECUTE stmt1; call p1(); call p2(); -SET alter_algorithm='NOCOPY'; -EXECUTE stmt; -EXECUTE stmt1; -call p1(); -call p2(); - -SET alter_algorithm='INSTANT'; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -EXECUTE stmt; ---error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -call p1(); - DROP TABLE t1; DROP PROCEDURE p1; DROP PROCEDURE p2; @@ -51,9 +32,8 @@ SET GLOBAL innodb_instant_alter_column_allowed=never; CREATE TABLE t1(id INT PRIMARY KEY, col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB; INSERT INTO t1 VALUES(1,1),(2,2),(3,3); -SET ALTER_ALGORITHM=INSTANT; --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON -ALTER TABLE t1 DROP COLUMN col1; +ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=INSTANT; --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY; ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT; diff --git a/mysql-test/suite/innodb/t/alter_not_null.combinations b/mysql-test/suite/innodb/t/alter_not_null.combinations deleted file mode 100644 index 815223ce1cb..00000000000 --- a/mysql-test/suite/innodb/t/alter_not_null.combinations +++ /dev/null @@ -1,5 +0,0 @@ -[COPY] ---alter_algorithm=copy - -[INPLACE] ---alter_algorithm=inplace diff --git a/mysql-test/suite/innodb/t/alter_not_null.inc b/mysql-test/suite/innodb/t/alter_not_null.inc new file mode 100644 index 00000000000..1c2a595381e --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_not_null.inc @@ -0,0 +1,106 @@ +# This test is run from alter_not_null.test with different combinations of +# alter_algorithm and strict mode + +let $sql_mode = `SELECT @@SQL_MODE`; +let $error_code = 0; + +if ($sql_mode == "STRICT_TRANS_TABLES") { + let $error_code = WARN_DATA_TRUNCATED; +} + +--echo # +--echo # sql_mode: $sql_mode alter_algorithm: $alter_algorithm +--echo # + +CREATE TABLE t1(f1 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +--enable_info +--error $error_code +--eval ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL, ALGORITHM=$alter_algorithm +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +--enable_info +--error $error_code +--eval ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL, ALGORITHM=$alter_algorithm +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +--enable_info +--error $error_code +--eval ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL, ALGORITHM=$alter_algorithm +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; +INSERT INTO t1 VALUES(NULL); +SELECT * FROM t1; +--enable_info +--error $error_code +--eval ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc', ALGORITHM=$alter_algorithm +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; +INSERT INTO t1 VALUES(2, 2, NULL); +SELECT * FROM t1; +--enable_info +--error $error_code +--eval ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2), ALGORITHM=$alter_algorithm +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; +INSERT INTO t1 VALUES(10, NULL); +SELECT * FROM t1; +--enable_info +--error $error_code +--eval ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), ALGORITHM=$alter_algorithm +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; +--enable_info +--eval ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=$alter_algorithm +--disable_info +DROP TABLE t1; + +CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; +--enable_info +--eval ALTER TABLE t1 FORCE, ALGORITHM=$alter_algorithm +--disable_info +DROP TABLE t1; + +# Alter ignore should work irrespective of sql mode + +CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; +INSERT INTO t1 VALUES(1, NULL); +--enable_info +ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; +--disable_info +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-16126 Crash or ASAN heap-buffer-overflow in +--echo # mach_read_from_n_little_endian upon ALTER TABLE with blob +--echo # + +CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; +--enable_info +--eval ALTER TABLE t1 ADD PRIMARY KEY(b), ALGORITHM=$alter_algorithm +--disable_info +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_not_null.test b/mysql-test/suite/innodb/t/alter_not_null.test index 646838593e2..148c103d6b2 100644 --- a/mysql-test/suite/innodb/t/alter_not_null.test +++ b/mysql-test/suite/innodb/t/alter_not_null.test @@ -1,102 +1,7 @@ ---source include/have_innodb.inc +# Run with STRICT and NOSCRIPT modes --source alter_sql_mode.inc -let $sql_mode = `SELECT @@SQL_MODE`; -let $error_code = 0; - -if ($sql_mode == "STRICT_TRANS_TABLES") { - let $error_code = WARN_DATA_TRUNCATED; -} - -CREATE TABLE t1(f1 INT)ENGINE=INNODB; -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; ---enable_info ---error $error_code -ALTER TABLE t1 CHANGE f1 f1 INT NOT NULL; ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1(f1 CHAR(10))ENGINE=INNODB; -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; ---enable_info ---error $error_code -ALTER TABLE t1 CHANGE f1 f1 CHAR(10) NOT NULL; ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1(f1 VARCHAR(10))ENGINE=INNODB; -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; ---enable_info ---error $error_code -ALTER TABLE t1 CHANGE f1 f1 VARCHAR(20) NOT NULL; ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1(f1 TEXT)ENGINE=INNODB; -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; ---enable_info ---error $error_code -ALTER TABLE t1 CHANGE f1 f1 TEXT NOT NULL DEFAULT 'abc'; ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT)ENGINE=INNODB; -INSERT INTO t1 VALUES(2, 2, NULL); -SELECT * FROM t1; ---enable_info ---error $error_code -ALTER TABLE t1 CHANGE f3 f3 INT NOT NULL DEFAULT (f1 + f2); ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1(f1 INT NOT NULL DEFAULT 0, b TINYINT)ENGINE=InnoDB; -INSERT INTO t1 VALUES(10, NULL); -SELECT * FROM t1; ---enable_info ---error $error_code -ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0); ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB; ---enable_info -ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL; ---disable_info -DROP TABLE t1; - -CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB; ---enable_info -ALTER TABLE t1 FORCE; ---disable_info -DROP TABLE t1; - -# Alter ignore should work irrespective of sql mode - -CREATE TABLE t1(c1 INT NOT NULL, c2 INT, PRIMARY KEY(c1))ENGINE=INNODB; -INSERT INTO t1 VALUES(1, NULL); ---enable_info -ALTER IGNORE TABLE t1 CHANGE c2 c2 INT NOT NULL DEFAULT 2; ---disable_info -SELECT * FROM t1; -DROP TABLE t1; - ---echo # ---echo # MDEV-16126 Crash or ASAN heap-buffer-overflow in ---echo # mach_read_from_n_little_endian upon ALTER TABLE with blob ---echo # - -CREATE TABLE t1(a INT, v INT AS (a), b INT, c BLOB) ENGINE=InnoDB; ---enable_info -ALTER TABLE t1 ADD PRIMARY KEY(b); ---disable_info -DROP TABLE t1; +let $alter_algorithm=COPY; +--source alter_not_null.inc +let $alter_algorithm=INPLACE; +--source alter_not_null.inc diff --git a/mysql-test/suite/innodb/t/innodb_bug53592.test b/mysql-test/suite/innodb/t/innodb_bug53592.test index f085cda7154..2c9b454bb7b 100644 --- a/mysql-test/suite/innodb/t/innodb_bug53592.test +++ b/mysql-test/suite/innodb/t/innodb_bug53592.test @@ -4,9 +4,6 @@ --source include/have_innodb.inc -# Use FIC for index creation -set alter_algorithm=0; - create table bug53592(a int) engine=innodb row_format=compact; alter table bug53592 add column b text charset utf8; @@ -33,32 +30,6 @@ check table bug53592; drop table bug53592; -# Running the same set of test when "alter_algorithm" is turned on -set alter_algorithm=1; - -create table bug53592(a int) engine=innodb row_format=compact; - -alter table bug53592 add column b text charset utf8; - -alter table bug53592 add column c blob not null; - -# Create a non-unique nonclustered index -create index bug53592_b on bug53592(b(81)); - -# Create a unique index -create unique index bug53592_c on bug53592(c(1)); - -# This will trigger a dup key error and will require fetching -# the index number through a index structure for the error reporting. -# To get the correct index number, the code should go through index -# translation table. Otherwise, it will get the wrong index -# number and later trigger a server crash. -set statement sql_mode = '' for -replace into bug53592 values (),(); - -check table bug53592; -drop table bug53592; - # Test a dup key reported by foreign key constriant. CREATE TABLE bug53592_1( col1 int, col2 int, diff --git a/mysql-test/suite/parts/r/alter_table.result b/mysql-test/suite/parts/r/alter_table.result index 0a78be2b215..86f1d79c87e 100644 --- a/mysql-test/suite/parts/r/alter_table.result +++ b/mysql-test/suite/parts/r/alter_table.result @@ -1,8 +1,6 @@ # # MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER # -set @save_alter_algorithm= @@session.alter_algorithm; -SET SESSION alter_algorithm=4; CREATE TABLE t1(a INT) engine=myisam PARTITION BY RANGE(a) SUBPARTITION BY KEY(a) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0,SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (20) (SUBPARTITION s2,SUBPARTITION s3)); show create table t1; Table Create Table @@ -17,10 +15,9 @@ SUBPARTITION BY KEY (`a`) PARTITION `p1` VALUES LESS THAN (20) (SUBPARTITION `s2` ENGINE = MyISAM, SUBPARTITION `s3` ENGINE = MyISAM)) -ALTER TABLE t1 ADD COLUMN c INT; +ALTER TABLE t1 ADD COLUMN c INT,ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY DROP table if exists t1; -set @@session.alter_algorithm= @save_alter_algorithm; # # MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata | # ERROR 1507 (HY000): Error in list of partitions to DROP diff --git a/mysql-test/suite/parts/r/partition_alter_instant.result b/mysql-test/suite/parts/r/partition_alter_instant.result index 5d904314fcb..ca44cf1d945 100644 --- a/mysql-test/suite/parts/r/partition_alter_instant.result +++ b/mysql-test/suite/parts/r/partition_alter_instant.result @@ -25,10 +25,7 @@ t2 CREATE TABLE `t2` ( `id` int(11) NOT NULL, `name` varchar(30) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=COMPACT -SET ALTER_ALGORITHM=INSTANT; -ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255), ALGORITHM=INSTANT; ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=INPLACE -SET ALTER_ALGORITHM=INPLACE; -ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255), ALGORITHM=INPLACE; DROP TABLE t1, t2; -SET ALTER_ALGORITHM=DEFAULT; diff --git a/mysql-test/suite/parts/t/alter_table.test b/mysql-test/suite/parts/t/alter_table.test index f1da7cc3284..31a50897d6c 100644 --- a/mysql-test/suite/parts/t/alter_table.test +++ b/mysql-test/suite/parts/t/alter_table.test @@ -14,15 +14,11 @@ --echo # MDEV-22649 SIGSEGV in ha_partition::create_partitioning_metadata on ALTER --echo # -set @save_alter_algorithm= @@session.alter_algorithm; -SET SESSION alter_algorithm=4; CREATE TABLE t1(a INT) engine=myisam PARTITION BY RANGE(a) SUBPARTITION BY KEY(a) (PARTITION p0 VALUES LESS THAN (10) (SUBPARTITION s0,SUBPARTITION s1), PARTITION p1 VALUES LESS THAN (20) (SUBPARTITION s2,SUBPARTITION s3)); show create table t1; --error ER_ALTER_OPERATION_NOT_SUPPORTED -ALTER TABLE t1 ADD COLUMN c INT; +ALTER TABLE t1 ADD COLUMN c INT,ALGORITHM=INSTANT; DROP table if exists t1; -set @@session.alter_algorithm= @save_alter_algorithm; - --echo # --echo # MDEV-22804 SIGSEGV in ha_partition::create_partitioning_metadata | diff --git a/mysql-test/suite/parts/t/partition_alter_instant.test b/mysql-test/suite/parts/t/partition_alter_instant.test index 3d798791517..46e451dce47 100644 --- a/mysql-test/suite/parts/t/partition_alter_instant.test +++ b/mysql-test/suite/parts/t/partition_alter_instant.test @@ -34,10 +34,7 @@ SHOW CREATE TABLE t2; ALTER TABLE t2 REMOVE PARTITIONING; ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; SHOW CREATE TABLE t2; -SET ALTER_ALGORITHM=INSTANT; --error ER_ALTER_OPERATION_NOT_SUPPORTED -ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); -SET ALTER_ALGORITHM=INPLACE; -ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255); +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255), ALGORITHM=INSTANT; +ALTER TABLE t1 ADD COLUMN col1 VARCHAR(255) NOT NULL DEFAULT repeat('a', 255), ALGORITHM=INPLACE; DROP TABLE t1, t2; -SET ALTER_ALGORITHM=DEFAULT; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result b/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result index 4f22c2a1f5f..f1657e4a319 100644 --- a/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result +++ b/mysql-test/suite/rpl/r/rpl_start_alter_ftwrl.result @@ -14,9 +14,8 @@ include/save_master_gtid.inc connection slave; include/sync_with_master_gtid.inc connection master; -SET @@session.alter_algorithm='INSTANT'; SET @@session.gtid_domain_id=11; -ALTER TABLE t1 ADD COLUMN b int; +ALTER TABLE t1 ADD COLUMN b int, algorithm=instant; # START Alter having exclusive lock is waiting for the signal connection slave; # FTWRL is sent first to wait for SA @@ -43,9 +42,9 @@ Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Gtid # # GTID #-#-# slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) ENGINE=innodb slave-bin.000001 # Gtid # # GTID #-#-# START ALTER -slave-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN b int +slave-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN b int, algorithm=instant slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# -slave-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN b int +slave-bin.000001 # Query # # use `test`; ALTER TABLE t1 ADD COLUMN b int, algorithm=instant connection master; DROP TABLE t1; connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_instant.result b/mysql-test/suite/rpl/r/rpl_start_alter_instant.result index 17aaad81aa4..c2adc90bd16 100644 --- a/mysql-test/suite/rpl/r/rpl_start_alter_instant.result +++ b/mysql-test/suite/rpl/r/rpl_start_alter_instant.result @@ -7,10 +7,8 @@ a int PRIMARY KEY, b varchar(50), c varchar(50) ) CHARACTER SET=latin1 engine=innodb; -SET SESSION alter_algorithm='INSTANT'; -ALTER TABLE tab MODIFY COLUMN b varchar(100); -SET SESSION alter_algorithm='NOCOPY'; -ALTER TABLE tab MODIFY COLUMN c varchar(100); +ALTER TABLE tab MODIFY COLUMN b varchar(100), algorithm=instant; +ALTER TABLE tab MODIFY COLUMN c varchar(100), algorithm=nocopy; SHOW CREATE TABLE tab; Table Create Table tab CREATE TABLE `tab` ( @@ -28,13 +26,13 @@ b varchar(50), c varchar(50) ) CHARACTER SET=latin1 engine=innodb master-bin.000001 # Gtid # # GTID #-#-# START ALTER -master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100), algorithm=instant master-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# -master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100), algorithm=instant master-bin.000001 # Gtid # # GTID #-#-# START ALTER -master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100), algorithm=nocopy master-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# -master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +master-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100), algorithm=nocopy connection slave; SHOW CREATE TABLE tab; Table Create Table @@ -53,13 +51,13 @@ b varchar(50), c varchar(50) ) CHARACTER SET=latin1 engine=innodb slave-bin.000001 # Gtid # # GTID #-#-# START ALTER -slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100), algorithm=instant slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# -slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100) +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN b varchar(100), algorithm=instant slave-bin.000001 # Gtid # # GTID #-#-# START ALTER -slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100), algorithm=nocopy slave-bin.000001 # Gtid # # GTID #-#-# COMMIT ALTER id=# -slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100) +slave-bin.000001 # Query # # use `test`; ALTER TABLE tab MODIFY COLUMN c varchar(100), algorithm=nocopy connection master; DROP TABLE tab; connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_options.result b/mysql-test/suite/rpl/r/rpl_start_alter_options.result deleted file mode 100644 index c150c18ad80..00000000000 --- a/mysql-test/suite/rpl/r/rpl_start_alter_options.result +++ /dev/null @@ -1,493 +0,0 @@ -include/master-slave.inc -[connection master] -connection slave; -stop slave; -change master to master_use_gtid= current_pos; -SET GLOBAL slave_parallel_threads=4; -set global slave_parallel_mode=optimistic; -set global gtid_strict_mode=1; -start slave; -connection master; -set binlog_alter_two_phase=true; -create table t1(a int , b int) engine=innodb; -create table a1(a int , b int) engine=myisam; -create temporary table tmp_tbl(a int, b int) engine=innodb; -alter table t1 add column if not exists c int , force , algorithm=default; -alter table t1 add column d int first, force , algorithm=default; -alter table t1 add column e int after c, force , algorithm=default; -alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=default; -alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=default; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=default; -alter table t1 add index if not exists index_1(f), force , algorithm=default; -alter table t1 drop index index_1, force , algorithm=default; -alter table t1 add unique key unique_1(g), force , algorithm=default; -alter table t1 drop index unique_1, force , algorithm=default; -alter table t1 add fulltext key f_1(h), force , algorithm=default; -alter table t1 drop column f, drop column g , force , algorithm=default; -alter table t1 add primary key(h), force , algorithm=copy; -alter table t1 drop primary key, force , algorithm=copy; -alter table t1 drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=default; -alter table t1 add period for system_time(f,h); -alter table t1 add system versioning; -alter table t1 drop system versioning; -alter table t1 drop column f, drop column g , drop column h, force , algorithm=default; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=default ;; -alter table t1 alter column f set default "****", force , algorithm=default ;; -alter table t1 alter column f drop default, force , algorithm=default ;; -alter table t1 change column g new_g char, force , algorithm=copy;; -alter table t1 modify column h varchar(100), force , algorithm=copy;; -alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=default ;; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=default; -alter table t1 add index if not exists index_1(f), force , algorithm=default; -alter table t1 disable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 enable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 rename t2, force , algorithm=default; -alter table t2 rename t1, force , algorithm=default; -alter table a1 order by a; -alter table t1 rename column f to new_f, force , algorithm=copy; -alter table t1 convert to character set 'utf8', force , algorithm=copy; -alter table t1 default character set 'utf8', force , algorithm=copy; -alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; -alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=default; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=default; -alter table t1 partition by hash(b) partitions 8; -alter table t1 remove partitioning; -alter table t1 drop column f ,drop column g, drop column h, force , algorithm=default; -# show binlog and clear status -connection slave; -reset master; -connection master; -connection master; -drop table t1, a1; -drop temporary table tmp_tbl; -connection slave; -include/stop_slave.inc -set global slave_parallel_threads = 0;; -set global slave_parallel_mode = optimistic;; -set global gtid_strict_mode = 0;; -include/start_slave.inc -connection slave; -stop slave; -change master to master_use_gtid= current_pos; -SET GLOBAL slave_parallel_threads=4; -set global slave_parallel_mode=optimistic; -set global gtid_strict_mode=1; -start slave; -connection master; -set binlog_alter_two_phase=true; -create table t1(a int , b int) engine=innodb; -create table a1(a int , b int) engine=myisam; -create temporary table tmp_tbl(a int, b int) engine=innodb; -alter table t1 add column if not exists c int , force , algorithm=inplace; -alter table t1 add column d int first, force , algorithm=inplace; -alter table t1 add column e int after c, force , algorithm=inplace; -alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=inplace; -alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=inplace; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=inplace; -alter table t1 add index if not exists index_1(f), force , algorithm=inplace; -alter table t1 drop index index_1, force , algorithm=inplace; -alter table t1 add unique key unique_1(g), force , algorithm=inplace; -alter table t1 drop index unique_1, force , algorithm=inplace; -alter table t1 add fulltext key f_1(h), force , algorithm=inplace; -alter table t1 drop column f, drop column g , force , algorithm=inplace; -alter table t1 add primary key(h), force , algorithm=copy; -alter table t1 drop primary key, force , algorithm=copy; -alter table t1 drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=inplace; -alter table t1 add period for system_time(f,h); -alter table t1 add system versioning; -alter table t1 drop system versioning; -alter table t1 drop column f, drop column g , drop column h, force , algorithm=inplace; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=inplace ;; -alter table t1 alter column f set default "****", force , algorithm=inplace ;; -alter table t1 alter column f drop default, force , algorithm=inplace ;; -alter table t1 change column g new_g char, force , algorithm=copy;; -alter table t1 modify column h varchar(100), force , algorithm=copy;; -alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=inplace ;; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=inplace; -alter table t1 add index if not exists index_1(f), force , algorithm=inplace; -alter table t1 disable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 enable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 rename t2, force , algorithm=inplace; -alter table t2 rename t1, force , algorithm=inplace; -alter table a1 order by a; -alter table t1 rename column f to new_f, force , algorithm=copy; -alter table t1 convert to character set 'utf8', force , algorithm=copy; -alter table t1 default character set 'utf8', force , algorithm=copy; -alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; -alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=inplace; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=inplace; -alter table t1 partition by hash(b) partitions 8; -alter table t1 remove partitioning; -alter table t1 drop column f ,drop column g, drop column h, force , algorithm=inplace; -# show binlog and clear status -connection slave; -reset master; -connection master; -connection master; -drop table t1, a1; -drop temporary table tmp_tbl; -connection slave; -include/stop_slave.inc -set global slave_parallel_threads = 0;; -set global slave_parallel_mode = optimistic;; -set global gtid_strict_mode = 0;; -include/start_slave.inc -connection slave; -stop slave; -change master to master_use_gtid= current_pos; -SET GLOBAL slave_parallel_threads=4; -set global slave_parallel_mode=optimistic; -set global gtid_strict_mode=1; -start slave; -connection master; -set binlog_alter_two_phase=true; -create table t1(a int , b int) engine=innodb; -create table a1(a int , b int) engine=myisam; -create temporary table tmp_tbl(a int, b int) engine=innodb; -alter table t1 add column if not exists c int , force , algorithm=copy; -alter table t1 add column d int first, force , algorithm=copy; -alter table t1 add column e int after c, force , algorithm=copy; -alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=copy; -alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=copy; -alter table tmp_tbl add column if not exists c int , force , algorithm=copy; -alter table tmp_tbl add column d int first, force , algorithm=copy; -alter table tmp_tbl add column e int after c, force , algorithm=copy; -alter table tmp_tbl add column f int after c, force , add column g int first ,add column h char, algorithm=copy; -alter table tmp_tbl drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=copy; -alter table t1 add index if not exists index_1(f), force , algorithm=copy; -alter table t1 drop index index_1, force , algorithm=copy; -alter table t1 add unique key unique_1(g), force , algorithm=copy; -alter table t1 drop index unique_1, force , algorithm=copy; -alter table t1 add fulltext key f_1(h), force , algorithm=copy; -alter table t1 drop column f, drop column g , force , algorithm=copy; -alter table tmp_tbl add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=copy; -alter table tmp_tbl add index if not exists index_1(f), force , algorithm=copy; -alter table tmp_tbl drop index index_1, force , algorithm=copy; -alter table tmp_tbl add unique key unique_1(g), force , algorithm=copy; -alter table tmp_tbl drop index unique_1, force , algorithm=copy; -alter table tmp_tbl drop column f, drop column g , force , algorithm=copy; -alter table t1 add primary key(h), force , algorithm=copy; -alter table t1 drop primary key, force , algorithm=copy; -alter table t1 drop column h, force , algorithm=copy; -alter table tmp_tbl add primary key(h), force , algorithm=copy; -alter table tmp_tbl drop primary key, force , algorithm=copy; -alter table tmp_tbl drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=copy; -alter table t1 add period for system_time(f,h); -alter table t1 add system versioning; -alter table t1 drop system versioning; -alter table t1 drop column f, drop column g , drop column h, force , algorithm=copy; -# show binlog and clear status -alter table tmp_tbl add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=copy; -alter table tmp_tbl drop column f, drop column g , drop column h, force , algorithm=copy; -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy ;; -alter table t1 alter column f set default "****", force , algorithm=copy ;; -alter table t1 alter column f drop default, force , algorithm=copy ;; -alter table t1 change column g new_g char, force , algorithm=copy;; -alter table t1 modify column h varchar(100), force , algorithm=copy;; -alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=copy ;; -alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy ;; -alter table tmp_tbl alter column f set default "****", force , algorithm=copy ;; -alter table tmp_tbl alter column f drop default, force , algorithm=copy ;; -alter table tmp_tbl change column g new_g char, force , algorithm=copy;; -alter table tmp_tbl modify column h varchar(100), force , algorithm=copy;; -alter table tmp_tbl drop column new_g ,drop column f, drop column h, force , algorithm=copy ;; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; -alter table t1 add index if not exists index_1(f), force , algorithm=copy; -alter table t1 disable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 enable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 rename t2, force , algorithm=copy; -alter table t2 rename t1, force , algorithm=copy; -alter table a1 order by a; -alter table t1 rename column f to new_f, force , algorithm=copy; -alter table t1 convert to character set 'utf8', force , algorithm=copy; -alter table t1 default character set 'utf8', force , algorithm=copy; -alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; -alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=copy; -alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; -alter table tmp_tbl add index if not exists index_1(f), force , algorithm=copy; -alter table tmp_tbl disable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`tmp_tbl` doesn't have this option -alter table tmp_tbl enable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`tmp_tbl` doesn't have this option -alter table a1 order by a; -alter table tmp_tbl rename column f to new_f, force , algorithm=copy; -alter table tmp_tbl convert to character set 'utf8', force , algorithm=copy; -alter table tmp_tbl default character set 'utf8', force , algorithm=copy; -alter table tmp_tbl default collate 'utf8_icelandic_ci', force , algorithm=copy; -alter table tmp_tbl drop column new_f ,drop column g, drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; -alter table t1 partition by hash(b) partitions 8; -alter table t1 remove partitioning; -alter table t1 drop column f ,drop column g, drop column h, force , algorithm=copy; -alter table tmp_tbl add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=copy; -alter table tmp_tbl drop column f ,drop column g, drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -connection master; -drop table t1, a1; -drop temporary table tmp_tbl; -connection slave; -include/stop_slave.inc -set global slave_parallel_threads = 0;; -set global slave_parallel_mode = optimistic;; -set global gtid_strict_mode = 0;; -include/start_slave.inc -# Prove formal support for nocopy and instant -connection slave; -stop slave; -change master to master_use_gtid= current_pos; -SET GLOBAL slave_parallel_threads=4; -set global slave_parallel_mode=optimistic; -set global gtid_strict_mode=1; -start slave; -connection master; -set binlog_alter_two_phase=true; -create table t1(a int , b int) engine=innodb; -create table a1(a int , b int) engine=myisam; -create temporary table tmp_tbl(a int, b int) engine=innodb; -alter table t1 add column if not exists c int , force , algorithm=instant; -alter table t1 add column d int first, force , algorithm=instant; -alter table t1 add column e int after c, force , algorithm=instant; -alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=instant; -alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=instant; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=instant; -alter table t1 add index if not exists index_1(f), force , algorithm=instant; -alter table t1 drop index index_1, force , algorithm=instant; -alter table t1 add unique key unique_1(g), force , algorithm=instant; -alter table t1 drop index unique_1, force , algorithm=instant; -alter table t1 add fulltext key f_1(h), force , algorithm=instant; -alter table t1 drop column f, drop column g , force , algorithm=instant; -alter table t1 add primary key(h), force , algorithm=copy; -alter table t1 drop primary key, force , algorithm=copy; -alter table t1 drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=instant; -alter table t1 add period for system_time(f,h); -alter table t1 add system versioning; -alter table t1 drop system versioning; -alter table t1 drop column f, drop column g , drop column h, force , algorithm=instant; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant ;; -alter table t1 alter column f set default "****", force , algorithm=instant ;; -alter table t1 alter column f drop default, force , algorithm=instant ;; -alter table t1 change column g new_g char, force , algorithm=copy;; -alter table t1 modify column h varchar(100), force , algorithm=copy;; -alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=instant ;; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant; -alter table t1 add index if not exists index_1(f), force , algorithm=instant; -alter table t1 disable keys, force , algorithm=copy; -alter table t1 enable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 rename t2, force , algorithm=instant; -alter table t2 rename t1, force , algorithm=instant; -alter table a1 order by a; -alter table t1 rename column f to new_f, force , algorithm=copy; -alter table t1 convert to character set 'utf8', force , algorithm=copy; -alter table t1 default character set 'utf8', force , algorithm=copy; -alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; -alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=instant; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=instant; -alter table t1 partition by hash(b) partitions 8; -alter table t1 remove partitioning; -alter table t1 drop column f ,drop column g, drop column h, force , algorithm=instant; -# show binlog and clear status -connection slave; -reset master; -connection master; -connection master; -drop table t1, a1; -drop temporary table tmp_tbl; -connection slave; -include/stop_slave.inc -set global slave_parallel_threads = 0;; -set global slave_parallel_mode = optimistic;; -set global gtid_strict_mode = 0;; -include/start_slave.inc -connection slave; -stop slave; -change master to master_use_gtid= current_pos; -SET GLOBAL slave_parallel_threads=4; -set global slave_parallel_mode=optimistic; -set global gtid_strict_mode=1; -start slave; -connection master; -set binlog_alter_two_phase=true; -create table t1(a int , b int) engine=innodb; -create table a1(a int , b int) engine=myisam; -create temporary table tmp_tbl(a int, b int) engine=innodb; -alter table t1 add column if not exists c int , force , algorithm=nocopy; -alter table t1 add column d int first, force , algorithm=nocopy; -alter table t1 add column e int after c, force , algorithm=nocopy; -alter table t1 add column f int after c, force , add column g int first ,add column h char, algorithm=nocopy; -alter table t1 drop column c, drop column d, drop column e, drop column f, drop column g , drop column h, force , algorithm=nocopy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f int after b, force , add column g int first ,add column h varchar(100), algorithm=nocopy; -alter table t1 add index if not exists index_1(f), force , algorithm=nocopy; -alter table t1 drop index index_1, force , algorithm=nocopy; -alter table t1 add unique key unique_1(g), force , algorithm=nocopy; -alter table t1 drop index unique_1, force , algorithm=nocopy; -alter table t1 add fulltext key f_1(h), force , algorithm=nocopy; -alter table t1 drop column f, drop column g , force , algorithm=nocopy; -alter table t1 add primary key(h), force , algorithm=copy; -alter table t1 drop primary key, force , algorithm=copy; -alter table t1 drop column h, force , algorithm=copy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b, add column g varchar(100) first ,add column h char, force , algorithm=nocopy; -alter table t1 add period for system_time(f,h); -alter table t1 add system versioning; -alter table t1 drop system versioning; -alter table t1 drop column f, drop column g , drop column h, force , algorithm=nocopy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy ;; -alter table t1 alter column f set default "****", force , algorithm=nocopy ;; -alter table t1 alter column f drop default, force , algorithm=nocopy ;; -alter table t1 change column g new_g char, force , algorithm=copy;; -alter table t1 modify column h varchar(100), force , algorithm=copy;; -alter table t1 drop column new_g ,drop column f, drop column h, force , algorithm=nocopy ;; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy; -alter table t1 add index if not exists index_1(f), force , algorithm=nocopy; -alter table t1 disable keys, force , algorithm=copy; -alter table t1 enable keys, force , algorithm=copy; -Warnings: -Note 1031 Storage engine InnoDB of the table `test`.`t1` doesn't have this option -alter table t1 rename t2, force , algorithm=nocopy; -alter table t2 rename t1, force , algorithm=nocopy; -alter table a1 order by a; -alter table t1 rename column f to new_f, force , algorithm=copy; -alter table t1 convert to character set 'utf8', force , algorithm=copy; -alter table t1 default character set 'utf8', force , algorithm=copy; -alter table t1 default collate 'utf8_icelandic_ci', force , algorithm=copy; -alter table t1 drop column new_f ,drop column g, drop column h, force , algorithm=nocopy; -# show binlog and clear status -connection slave; -reset master; -connection master; -alter table t1 add column f varchar(100) after b,add column g varchar(100) first ,add column h char, force , algorithm=nocopy; -alter table t1 partition by hash(b) partitions 8; -alter table t1 remove partitioning; -alter table t1 drop column f ,drop column g, drop column h, force , algorithm=nocopy; -# show binlog and clear status -connection slave; -reset master; -connection master; -connection master; -drop table t1, a1; -drop temporary table tmp_tbl; -connection slave; -include/stop_slave.inc -set global slave_parallel_threads = 0;; -set global slave_parallel_mode = optimistic;; -set global gtid_strict_mode = 0;; -include/start_slave.inc -include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test b/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test index a8528cc6197..cd8921bde88 100644 --- a/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test +++ b/mysql-test/suite/rpl/t/rpl_start_alter_ftwrl.test @@ -33,9 +33,8 @@ CREATE TABLE t1 (a INT) ENGINE=innodb; --source include/sync_with_master_gtid.inc --connection master -SET @@session.alter_algorithm='INSTANT'; SET @@session.gtid_domain_id=11; -ALTER TABLE t1 ADD COLUMN b int; +ALTER TABLE t1 ADD COLUMN b int, algorithm=instant; --echo # START Alter having exclusive lock is waiting for the signal diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_instant.test b/mysql-test/suite/rpl/t/rpl_start_alter_instant.test index ecb62e04fad..248fed58af3 100644 --- a/mysql-test/suite/rpl/t/rpl_start_alter_instant.test +++ b/mysql-test/suite/rpl/t/rpl_start_alter_instant.test @@ -11,10 +11,9 @@ CREATE OR REPLACE TABLE tab ( c varchar(50) ) CHARACTER SET=latin1 engine=innodb; -SET SESSION alter_algorithm='INSTANT'; -ALTER TABLE tab MODIFY COLUMN b varchar(100); -SET SESSION alter_algorithm='NOCOPY'; -ALTER TABLE tab MODIFY COLUMN c varchar(100); + +ALTER TABLE tab MODIFY COLUMN b varchar(100), algorithm=instant; +ALTER TABLE tab MODIFY COLUMN c varchar(100), algorithm=nocopy; SHOW CREATE TABLE tab; --source include/show_binlog_events.inc diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_options.test b/mysql-test/suite/rpl/t/rpl_start_alter_options.test deleted file mode 100644 index 12125b49122..00000000000 --- a/mysql-test/suite/rpl/t/rpl_start_alter_options.test +++ /dev/null @@ -1,31 +0,0 @@ -# This test will test all the option related to the Alter Table command -# NOTE not all alter statements will follow alter_algorithm since for some statements -# copy is only option -# parameters -# $alter_algorithm {DEFAULT|INPLACE|COPY|NOCOPY|INSTANT} -# $show_binlog -# - ---source include/have_partition.inc ---source include/have_innodb.inc ---source include/master-slave.inc - ---let $alter_algorithm= default -#--let $show_binlog= false ---source include/start_alter_options.inc - ---let $alter_algorithm= inplace ---source include/start_alter_options.inc - ---let $alter_algorithm= copy ---source include/start_alter_options.inc - ---echo # Prove formal support for nocopy and instant ---let $alter_algorithm= instant ---source include/start_alter_options.inc - ---let $alter_algorithm= nocopy ---source include/start_alter_options.inc - - ---source include/rpl_end.inc diff --git a/mysql-test/suite/sys_vars/r/alter_algorithm_basic.result b/mysql-test/suite/sys_vars/r/alter_algorithm_basic.result index 39cfad4d35c..33e01308753 100644 --- a/mysql-test/suite/sys_vars/r/alter_algorithm_basic.result +++ b/mysql-test/suite/sys_vars/r/alter_algorithm_basic.result @@ -1,89 +1,21 @@ SET @start_global_value = @@global.alter_algorithm; -SET GLOBAL alter_algorithm=1.1; -ERROR 42000: Incorrect argument type to variable 'alter_algorithm' -SET GLOBAL alter_algorithm=-1; -ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '-1' -SET GLOBAL alter_algorithm=weird; -ERROR 42000: Variable 'alter_algorithm' can't be set to the value of 'weird' -SET GLOBAL alter_algorithm=4; -SELECT @@global.alter_algorithm; -@@global.alter_algorithm -INSTANT -SET GLOBAL alter_algorithm=3; -SELECT @@global.alter_algorithm; -@@global.alter_algorithm -NOCOPY -SET GLOBAL alter_algorithm=0; SELECT @@global.alter_algorithm; @@global.alter_algorithm DEFAULT -SET GLOBAL alter_algorithm=1; -SELECT @@global.alter_algorithm; -@@global.alter_algorithm -COPY SET GLOBAL alter_algorithm=2; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations SELECT @@global.alter_algorithm; @@global.alter_algorithm -INPLACE +DEFAULT SET GLOBAL alter_algorithm=5; ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '5' SELECT @@global.alter_algorithm; @@global.alter_algorithm -INPLACE -SET GLOBAL alter_algorithm=NOCOPY; -SET alter_algorithm=1.1; -ERROR 42000: Incorrect argument type to variable 'alter_algorithm' -SET alter_algorithm=-1; -ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '-1' -SET alter_algorithm=weird; -ERROR 42000: Variable 'alter_algorithm' can't be set to the value of 'weird' -SET alter_algorithm=4; -SELECT @@alter_algorithm; -@@alter_algorithm -INSTANT -SET alter_algorithm=3; -SELECT @@alter_algorithm; -@@alter_algorithm -NOCOPY -SET alter_algorithm=0; -SELECT @@alter_algorithm; -@@alter_algorithm DEFAULT -SET alter_algorithm=1; -SELECT @@alter_algorithm; -@@alter_algorithm -COPY -SET alter_algorithm=2; -SELECT @@alter_algorithm; -@@alter_algorithm -INPLACE -SET alter_algorithm=5; -ERROR 42000: Variable 'alter_algorithm' can't be set to the value of '5' -SELECT @@alter_algorithm; -@@alter_algorithm -INPLACE SET SESSION alter_algorithm=INSTANT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm INSTANT -SET SESSION alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm NOCOPY -SET SESSION alter_algorithm='DEFAULT'; +Warnings: +Warning 4200 The variable '@@alter_algorithm' is deleted and ignored. It it only exists for compatiblity with old installations SHOW SESSION VARIABLES LIKE 'alter_algorithm'; Variable_name Value alter_algorithm DEFAULT -SET SESSION alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm NOCOPY -SET GLOBAL alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm NOCOPY -SET SESSION alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -Variable_name Value -alter_algorithm DEFAULT -SET GLOBAL alter_algorithm = @start_global_value; diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 384f458942d..86cc1fd8f0c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -25,7 +25,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ALTER_ALGORITHM VARIABLE_SCOPE SESSION VARIABLE_TYPE ENUM -VARIABLE_COMMENT Specify the alter table algorithm +VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 5515b5a03c8..8d1b615b567 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -25,7 +25,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ALTER_ALGORITHM VARIABLE_SCOPE SESSION VARIABLE_TYPE ENUM -VARIABLE_COMMENT Specify the alter table algorithm +VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test b/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test index 69a5320a98c..d877bf3c181 100644 --- a/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test +++ b/mysql-test/suite/sys_vars/t/alter_algorithm_basic.test @@ -1,18 +1,5 @@ SET @start_global_value = @@global.alter_algorithm; ---error ER_WRONG_TYPE_FOR_VAR -SET GLOBAL alter_algorithm=1.1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL alter_algorithm=-1; ---error ER_WRONG_VALUE_FOR_VAR -SET GLOBAL alter_algorithm=weird; -SET GLOBAL alter_algorithm=4; -SELECT @@global.alter_algorithm; -SET GLOBAL alter_algorithm=3; -SELECT @@global.alter_algorithm; -SET GLOBAL alter_algorithm=0; -SELECT @@global.alter_algorithm; -SET GLOBAL alter_algorithm=1; SELECT @@global.alter_algorithm; SET GLOBAL alter_algorithm=2; SELECT @@global.alter_algorithm; @@ -20,39 +7,5 @@ SELECT @@global.alter_algorithm; SET GLOBAL alter_algorithm=5; SELECT @@global.alter_algorithm; -SET GLOBAL alter_algorithm=NOCOPY; - ---error ER_WRONG_TYPE_FOR_VAR -SET alter_algorithm=1.1; ---error ER_WRONG_VALUE_FOR_VAR -SET alter_algorithm=-1; ---error ER_WRONG_VALUE_FOR_VAR -SET alter_algorithm=weird; -SET alter_algorithm=4; -SELECT @@alter_algorithm; -SET alter_algorithm=3; -SELECT @@alter_algorithm; -SET alter_algorithm=0; -SELECT @@alter_algorithm; -SET alter_algorithm=1; -SELECT @@alter_algorithm; -SET alter_algorithm=2; -SELECT @@alter_algorithm; ---error ER_WRONG_VALUE_FOR_VAR -SET alter_algorithm=5; -SELECT @@alter_algorithm; - SET SESSION alter_algorithm=INSTANT; SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -SET SESSION alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -SET SESSION alter_algorithm='DEFAULT'; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -SET SESSION alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -SET GLOBAL alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; -SET SESSION alter_algorithm=DEFAULT; -SHOW SESSION VARIABLES LIKE 'alter_algorithm'; - -SET GLOBAL alter_algorithm = @start_global_value; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f89b512689d..98d0a09dd59 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5333,6 +5333,7 @@ static int init_server_components() /* removed in 11.5 */ MARIADB_REMOVED_OPTION("wsrep-load-data-splitting"), + MARIADB_REMOVED_OPTION("alter-algorithm"), {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index 2cbb112638e..d335255c77d 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -1235,8 +1235,6 @@ handle_rpl_parallel_thread(void *arg) thd->system_thread= SYSTEM_THREAD_SLAVE_SQL; thd->security_ctx->skip_grants(); thd->variables.max_allowed_packet= slave_max_allowed_packet; - /* Ensure that slave can exeute any alter table it gets from master */ - thd->variables.alter_algorithm= (ulong) Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; thd->slave_thread= 1; set_slave_thread_options(thd); diff --git a/sql/slave.cc b/sql/slave.cc index 7081096b513..2bec9d56c8d 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5531,9 +5531,6 @@ pthread_handler_t handle_slave_sql(void *arg) */ thd->variables.binlog_annotate_row_events= 0; - /* Ensure that slave can exeute any alter table it gets from master */ - thd->variables.alter_algorithm= (ulong) Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; - server_threads.insert(thd); /* We are going to set slave_running to 1. Assuming slave I/O thread is diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 815763662b4..c40867b5043 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -186,9 +186,7 @@ bool Alter_info::supports_lock(THD *thd, bool online, case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: // If SHARED lock and no particular algorithm was requested, use COPY. if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED && - algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT && - thd->variables.alter_algorithm == - Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) + algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) return false; if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED || @@ -258,7 +256,7 @@ Alter_info::enum_alter_table_algorithm Alter_info::algorithm(const THD *thd) const { if (requested_algorithm == ALTER_TABLE_ALGORITHM_NONE) - return (Alter_info::enum_alter_table_algorithm) thd->variables.alter_algorithm; + return ALTER_TABLE_ALGORITHM_DEFAULT; return requested_algorithm; } diff --git a/sql/sql_class.h b/sql/sql_class.h index b7e7ade4b76..f9e39c4977c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -816,7 +816,7 @@ typedef struct system_variables ulong query_cache_type; ulong tx_isolation; ulong updatable_views_with_limit; - ulong alter_algorithm; + ulong alter_algorithm_unused; ulong server_id; ulong session_track_transaction_info; ulong threadpool_priority; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b6c0c810ce2..b7dbf9e764e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11177,10 +11177,7 @@ do_continue:; // If SHARED lock and no particular algorithm was requested, use COPY. if (ha_alter_info.inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK && alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED && - alter_info->algorithm(thd) == - Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT && - thd->variables.alter_algorithm == - Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) + alter_info->algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) use_inplace= false; if (ha_alter_info.inplace_supported == HA_ALTER_INPLACE_NOT_SUPPORTED) diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 6dd30fe35ed..2c18a45f99e 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2831,10 +2831,23 @@ static Sys_var_mybool Sys_skip_grant_tables( static const char *alter_algorithm_modes[]= {"DEFAULT", "COPY", "INPLACE", "NOCOPY", "INSTANT", NULL}; + +static bool variable_is_ignored(sys_var *self, THD *thd, set_var *var) +{ + var->save_result.longlong_value= 0; + return false; +} + static Sys_var_enum Sys_alter_algorithm( - "alter_algorithm", "Specify the alter table algorithm", - SESSION_VAR(alter_algorithm), CMD_LINE(OPT_ARG), - alter_algorithm_modes, DEFAULT(0)); + "alter_algorithm", + UNUSED_HELP, + SESSION_VAR(alter_algorithm_unused), + CMD_LINE(OPT_ARG, OPT_REMOVED_OPTION), + alter_algorithm_modes, DEFAULT(0), + NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(variable_is_ignored), ON_UPDATE(0), + DEPRECATED(1105,"")); + static bool check_old_passwords(sys_var *self, THD *thd, set_var *var) { diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result deleted file mode 100644 index 350a723f6b1..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_32683.result +++ /dev/null @@ -1,16 +0,0 @@ -# -# MDEV-32683 Spider engine does not load with non-default alter-algorithm -# -set global alter_algorithm=INSTANT; -install plugin spider soname 'ha_spider'; -select plugin_name, plugin_status, plugin_type, plugin_license, load_option from information_schema.plugins where plugin_name like 'spider'; -plugin_name plugin_status plugin_type plugin_license load_option -SPIDER ACTIVE STORAGE ENGINE GPL ON -uninstall plugin spider; -drop table mysql.spider_link_failed_log, mysql.spider_link_mon_servers, mysql.spider_tables, mysql.spider_table_crd, mysql.spider_table_position_for_recovery, mysql.spider_table_sts, mysql.spider_xa, mysql.spider_xa_failed_log, mysql.spider_xa_member; -drop function spider_direct_sql; -drop function spider_bg_direct_sql; -drop function spider_ping_table; -drop function spider_copy_tables; -drop function spider_flush_table_mon_cache; -set global alter_algorithm=DEFAULT; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test deleted file mode 100644 index d208957f048..00000000000 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_32683.test +++ /dev/null @@ -1,14 +0,0 @@ ---echo # ---echo # MDEV-32683 Spider engine does not load with non-default alter-algorithm ---echo # -set global alter_algorithm=INSTANT; -install plugin spider soname 'ha_spider'; -select plugin_name, plugin_status, plugin_type, plugin_license, load_option from information_schema.plugins where plugin_name like 'spider'; -uninstall plugin spider; -drop table mysql.spider_link_failed_log, mysql.spider_link_mon_servers, mysql.spider_tables, mysql.spider_table_crd, mysql.spider_table_position_for_recovery, mysql.spider_table_sts, mysql.spider_xa, mysql.spider_xa_failed_log, mysql.spider_xa_member; -drop function spider_direct_sql; -drop function spider_bg_direct_sql; -drop function spider_ping_table; -drop function spider_copy_tables; -drop function spider_flush_table_mon_cache; -set global alter_algorithm=DEFAULT;