From 2a57396e59e42cbfac51bed5231c2bdb2d7fe39a Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 21 Oct 2022 12:33:22 +0400 Subject: [PATCH] MDEV-29481 mariadb-upgrade prints confusing statement This is a new version of the patch instead of the reverted: MDEV-28727 ALTER TABLE ALGORITHM=NOCOPY does not work after upgrade Ignore the difference in key packing flags HA_BINARY_PACK_KEY and HA_PACK_KEY during ALTER to allow ALGORITHM=INSTANT and ALGORITHM=NOCOPY in more cases. If for some reasons (e.g. due to a bug fix such as MDEV-20704) these cumulative (over all segments) flags in KEY::flags are different for the old and new table inside compare_keys_but_name(), the difference in HA_BINARY_PACK_KEY and HA_PACK_KEY in KEY::flags is not really important: MyISAM and Aria can handle such cases well: per-segment flags are stored in MYI and MAI files anyway and they are read during ha_myisam::open() ha_maria::open() time. So indexes get opened with correct per-segment flags that were calculated during the table CREATE time, no matter what the old (CREATE time) and new (ALTER TIME) per-index compression flags are, and no matter if they are equal or not. All other engine ignore key compression flags, so this change is safe for other engines as well. --- include/my_base.h | 4 +- .../main/alter_table_upgrade_aria.result | 53 ++++++++++ mysql-test/main/alter_table_upgrade_aria.test | 21 ++++ ...er_table_upgrade_mdev29481_myisam_aria.inc | 59 +++++++++++ .../main/alter_table_upgrade_myisam.result | 52 ++++++++++ .../main/alter_table_upgrade_myisam.test | 17 ++++ .../alter_table_upgrade_myisam_debug.result | 92 ++++++++++++++++++ .../alter_table_upgrade_myisam_debug.test | 19 ++++ .../mysql_upgrade/mdev29481_100104_aria.MAD | Bin 0 -> 8192 bytes .../mysql_upgrade/mdev29481_100104_aria.MAI | Bin 0 -> 8192 bytes .../mysql_upgrade/mdev29481_100104_aria.frm | Bin 0 -> 923 bytes .../mysql_upgrade/mdev29481_100104_innodb.frm | Bin 0 -> 934 bytes .../mysql_upgrade/mdev29481_100104_myisam.MYD | 0 .../mysql_upgrade/mdev29481_100104_myisam.MYI | Bin 0 -> 1024 bytes .../mysql_upgrade/mdev29481_100104_myisam.frm | Bin 0 -> 925 bytes .../suite/innodb/r/alter_table_upgrade.result | 36 +++++++ .../suite/innodb/t/alter_table_upgrade.test | 36 +++++++ 17 files changed, 387 insertions(+), 2 deletions(-) create mode 100644 mysql-test/main/alter_table_upgrade_aria.result create mode 100644 mysql-test/main/alter_table_upgrade_aria.test create mode 100644 mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc create mode 100644 mysql-test/main/alter_table_upgrade_myisam.result create mode 100644 mysql-test/main/alter_table_upgrade_myisam.test create mode 100644 mysql-test/main/alter_table_upgrade_myisam_debug.result create mode 100644 mysql-test/main/alter_table_upgrade_myisam_debug.test create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.MAD create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.MAI create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.frm create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_innodb.frm create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.MYD create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.MYI create mode 100644 mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.frm create mode 100644 mysql-test/suite/innodb/r/alter_table_upgrade.result create mode 100644 mysql-test/suite/innodb/t/alter_table_upgrade.test diff --git a/include/my_base.h b/include/my_base.h index 7016766ce58..d045251778f 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -272,8 +272,8 @@ enum ha_base_keytype { #define HA_GENERATED_KEY 8192U /* Automatically generated key */ /* The combination of the above can be used for key type comparison. */ -#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \ - HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ +#define HA_KEYFLAG_MASK (HA_NOSAME | HA_AUTO_KEY | \ + HA_FULLTEXT | HA_UNIQUE_CHECK | \ HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) /* diff --git a/mysql-test/main/alter_table_upgrade_aria.result b/mysql-test/main/alter_table_upgrade_aria.result new file mode 100644 index 00000000000..10afd128649 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_aria.result @@ -0,0 +1,53 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +SET @debug_key_flags=NULL; +SET default_storage_engine=ARIA; +CREATE PROCEDURE debug_show_key_flags() +BEGIN +IF @debug_key_flags IS TRUE +THEN +FLUSH TABLES; +-- Wrap SET into EXECUTE IMMEDIATE to avoid +-- parse time "Unknown system variable" errors in release builds. +EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; +SELECT * FROM t1 LIMIT 0; +EXECUTE IMMEDIATE "SET debug_dbug=''"; +END IF; +END; +$$ +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` double(18,7) DEFAULT NULL, + KEY `d` (`d`) +) ENGINE=Aria DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PAGE_CHECKSUM=1 +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +DROP TABLE t1; +DROP PROCEDURE debug_show_key_flags; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alter_table_upgrade_aria.test b/mysql-test/main/alter_table_upgrade_aria.test new file mode 100644 index 00000000000..5b87095f515 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_aria.test @@ -0,0 +1,21 @@ +--source include/have_aria.inc + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +let $table= std_data/mysql_upgrade/mdev29481_100104_aria; +let $EXT_DAT= MAD; +let $EXT_IDX= MAI; +SET @debug_key_flags=NULL; +SET default_storage_engine=ARIA; +--source alter_table_upgrade_mdev29481_myisam_aria.inc + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc b/mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc new file mode 100644 index 00000000000..0a8759eccdd --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_mdev29481_myisam_aria.inc @@ -0,0 +1,59 @@ +let $datadir=`select @@datadir`; + +DELIMITER $$; +CREATE PROCEDURE debug_show_key_flags() +BEGIN + IF @debug_key_flags IS TRUE + THEN + FLUSH TABLES; + -- Wrap SET into EXECUTE IMMEDIATE to avoid + -- parse time "Unknown system variable" errors in release builds. + EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; + SELECT * FROM t1 LIMIT 0; + EXECUTE IMMEDIATE "SET debug_dbug=''"; + END IF; +END; +$$ +DELIMITER ;$$ + + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +SHOW CREATE TABLE t1; +CHECK TABLE t1 FOR UPGRADE; +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +REPAIR TABLE t1; +CALL debug_show_key_flags(); +DROP TABLE t1; + +copy_file $table.frm $datadir/test/t1.frm; +copy_file $table.$EXT_DAT $datadir/test/t1.$EXT_DAT; +copy_file $table.$EXT_IDX $datadir/test/t1.$EXT_IDX; +CALL debug_show_key_flags(); +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +DROP TABLE t1; + +DROP PROCEDURE debug_show_key_flags; diff --git a/mysql-test/main/alter_table_upgrade_myisam.result b/mysql-test/main/alter_table_upgrade_myisam.result new file mode 100644 index 00000000000..06bd1b70a0a --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam.result @@ -0,0 +1,52 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +SET @debug_key_flags=NULL; +CREATE PROCEDURE debug_show_key_flags() +BEGIN +IF @debug_key_flags IS TRUE +THEN +FLUSH TABLES; +-- Wrap SET into EXECUTE IMMEDIATE to avoid +-- parse time "Unknown system variable" errors in release builds. +EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; +SELECT * FROM t1 LIMIT 0; +EXECUTE IMMEDIATE "SET debug_dbug=''"; +END IF; +END; +$$ +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` double(18,7) DEFAULT NULL, + KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +CALL debug_show_key_flags(); +DROP TABLE t1; +CALL debug_show_key_flags(); +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +DROP TABLE t1; +DROP PROCEDURE debug_show_key_flags; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alter_table_upgrade_myisam.test b/mysql-test/main/alter_table_upgrade_myisam.test new file mode 100644 index 00000000000..251ca3e3555 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam.test @@ -0,0 +1,17 @@ +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +let $table= std_data/mysql_upgrade/mdev29481_100104_myisam; +let $EXT_DAT= MYD; +let $EXT_IDX= MYI; +SET @debug_key_flags=NULL; +--source alter_table_upgrade_mdev29481_myisam_aria.inc + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/alter_table_upgrade_myisam_debug.result b/mysql-test/main/alter_table_upgrade_myisam_debug.result new file mode 100644 index 00000000000..ed135585d9d --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam_debug.result @@ -0,0 +1,92 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +SET @debug_key_flags=TRUE; +CREATE PROCEDURE debug_show_key_flags() +BEGIN +IF @debug_key_flags IS TRUE +THEN +FLUSH TABLES; +-- Wrap SET into EXECUTE IMMEDIATE to avoid +-- parse time "Unknown system variable" errors in release builds. +EXECUTE IMMEDIATE "SET debug_dbug='+d,key'"; +SELECT * FROM t1 LIMIT 0; +EXECUTE IMMEDIATE "SET debug_dbug=''"; +END IF; +END; +$$ +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `d` double(18,7) DEFAULT NULL, + KEY `d` (`d`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +CHECK TABLE t1 FOR UPGRADE; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=INSTANT; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +ALTER TABLE t1 MODIFY d DOUBLE DEFAULT 10, ALGORITHM=NOCOPY; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000068 (HA_NULL_PART_KEY|HA_BINARY_PACK_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +ALTER TABLE t1 FORCE; +CALL debug_show_key_flags(); +d +Warnings: +Note 1105 DBUG: ha_myisam::open: name=`d` flags=00000048 (HA_NULL_PART_KEY|HA_VAR_LENGTH_KEY) +Note 1105 DBUG: seg[0].type=6 DOUBLE +Note 1105 DBUG: seg[0].flag=00000850 (HA_CAN_MEMCMP|HA_SWAP_KEY|HA_NULL_PART) +DROP TABLE t1; +DROP PROCEDURE debug_show_key_flags; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alter_table_upgrade_myisam_debug.test b/mysql-test/main/alter_table_upgrade_myisam_debug.test new file mode 100644 index 00000000000..8e26bcd2453 --- /dev/null +++ b/mysql-test/main/alter_table_upgrade_myisam_debug.test @@ -0,0 +1,19 @@ +--source include/have_debug.inc + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +let $table= std_data/mysql_upgrade/mdev29481_100104_myisam; +let $EXT_DAT= MYD; +let $EXT_IDX= MYI; +SET @debug_key_flags=TRUE; +--source alter_table_upgrade_mdev29481_myisam_aria.inc + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.MAD b/mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.MAD new file mode 100644 index 0000000000000000000000000000000000000000..3dcc005ec0d03681b402e75f595130e784a4a5d5 GIT binary patch literal 8192 zcmeIu0Sy2E3<4nghrZ_c1`$XwV8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* J20jm5+W{%^1N;C0 literal 0 HcmV?d00001 diff --git a/mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.MAI b/mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.MAI new file mode 100644 index 0000000000000000000000000000000000000000..d11da43bf2bde4728b7301bc49c16fcf25ae6daf GIT binary patch literal 8192 zcmeIuu?oU45C-5s4XrJdf|HH~#W!$tc6AV3+*}+T++74mSD(STtIy#JDCi(guC14} z0V~xf_>U&n%NrP3Q&Lo i6rcbFC_n)UP=Epypa2CZKmiI+fC3bt00k(}B=837oHJ7Z literal 0 HcmV?d00001 diff --git a/mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.frm b/mysql-test/std_data/mysql_upgrade/mdev29481_100104_aria.frm new file mode 100644 index 0000000000000000000000000000000000000000..81d7672c4055329b46bf0b2722da021988142c98 GIT binary patch literal 923 zcmeyz$f+g75XQjBFq@fy;U^;}0~|0(GjK34u!8tN8UlVY0y*uB416#F27#6pyo#pt z1>Y_^_$1^-$=9c8ObiT+KxHfpnLvF&1_NUQP)NI-gW-S5f4II;#&8S)r1)iFa4gD9 sgm}`F(G-*rMlb+*UkHdff%yUk0vN==`2)-sVgP3nAe$AK+dw%50P?{ZKL7v# literal 0 HcmV?d00001 diff --git a/mysql-test/std_data/mysql_upgrade/mdev29481_100104_innodb.frm b/mysql-test/std_data/mysql_upgrade/mdev29481_100104_innodb.frm new file mode 100644 index 0000000000000000000000000000000000000000..3ff86d1dca1d299301b9bcf0c19ed928e9c81faa GIT binary patch literal 934 zcmeyz$jKwb5XQjBu#B03;U^;}0~|2PF>o+2u!8uCFu|XU3=ACYj0^%W0R{oJWtLAL zcL}~(b(F37M*Xhh3?>E!MxZiwhD@M-AcKLi0Vt&1&cX0MGo`}tKV0i5W7vfNQslBR zc;@BhyEsAoXvb&=N(v(wfV?jR#GDMg@K6X~5Ci8Buz(N)IGX_3tcnZ_|C35Hb5i0< KGILY^GXMbmSRTCq literal 0 HcmV?d00001 diff --git a/mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.MYD b/mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.MYD new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.MYI b/mysql-test/std_data/mysql_upgrade/mdev29481_100104_myisam.MYI new file mode 100644 index 0000000000000000000000000000000000000000..d36f27ac0cf00dce42d7f47571bcd566c7c18bbd GIT binary patch literal 1024 zcmezOkDZZ$i7|v>149bK5e7yEAmRX$K=2<-Vj=!R0Yr)giwYbY_^_$1^-$=9bDObiT+KxHfpnLvF&1_NUQP)NI-gW-S5f4II;#&8S)r1)iH@U8R= ucJzgK)0EK^loUoV0C`^sh&h2d0|o*Z#K1WO%okz+XA>Zs6`0>Zc?AH~4H^#s literal 0 HcmV?d00001 diff --git a/mysql-test/suite/innodb/r/alter_table_upgrade.result b/mysql-test/suite/innodb/r/alter_table_upgrade.result new file mode 100644 index 00000000000..eebabd561ca --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_table_upgrade.result @@ -0,0 +1,36 @@ +# +# Start of 10.4 tests +# +# +# MDEV-29481 mariadb-upgrade prints confusing statement +# +CREATE TABLE pet4 ( +build_time double(18,7) DEFAULT NULL, +KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +SHOW CREATE TABLE pet4; +Table Create Table +pet4 CREATE TABLE `pet4` ( + `build_time` double(18,7) DEFAULT NULL, + KEY `idx1` (`build_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci +CHECK TABLE pet4 FOR UPGRADE; +Table Op Msg_type Msg_text +test.pet4 check status OK +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE pet4; +CREATE TABLE pet4 ( +build_time double(18,7) DEFAULT NULL, +KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +SHOW CREATE TABLE pet4; +Table Create Table +pet4 CREATE TABLE `pet4` ( + `build_time` double(18,7) DEFAULT NULL, + KEY `idx1` (`build_time`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY; +DROP TABLE pet4; +# +# End of 10.4 tests +# diff --git a/mysql-test/suite/innodb/t/alter_table_upgrade.test b/mysql-test/suite/innodb/t/alter_table_upgrade.test new file mode 100644 index 00000000000..cd058aeee3c --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_table_upgrade.test @@ -0,0 +1,36 @@ +--source include/have_innodb.inc + +let $datadir=`select @@datadir`; + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-29481 mariadb-upgrade prints confusing statement +--echo # + +CREATE TABLE pet4 ( + build_time double(18,7) DEFAULT NULL, + KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +remove_file $datadir/test/pet4.frm; +copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm; +SHOW CREATE TABLE pet4; +CHECK TABLE pet4 FOR UPGRADE; +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=INSTANT; +DROP TABLE pet4; + +CREATE TABLE pet4 ( + build_time double(18,7) DEFAULT NULL, + KEY idx1 (build_time)) ENGINE=InnoDB; +FLUSH TABLES; +remove_file $datadir/test/pet4.frm; +copy_file std_data/mysql_upgrade/mdev29481_100104_innodb.frm $datadir/test/pet4.frm; +SHOW CREATE TABLE pet4; +ALTER TABLE pet4 ADD i1 INTEGER, ALGORITHM=NOCOPY; +DROP TABLE pet4; + +--echo # +--echo # End of 10.4 tests +--echo #