Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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.
- Loading branch information
Showing
17 changed files
with
387 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 # |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| # |
Oops, something went wrong.