Commit 112870d7 authored by Christian Gonzalez's avatar Christian Gonzalez Committed by Daniel Black

MDEV-16735 Ensure mysql_upgrade works when changing alter_algorithm

MDEV-16735 describes how mysql_upgrade fails when alter_algorithm
is set to a value different than 'DEFAULT'/'COPY'. It was marked as
fixed by 0ee08683, but the fix didn't covered the possibility of having
the global value of alter_algorithm set to something different than
'DEFAULT'/'COPY'. To ensure that the upgrade process works properly
regardless the global value of alter_altorithm, this commit force it's
value to 'DEFAULT' (note the quotes) for the mysql_upgrade session.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer
Amazon Web Services, Inc.
parent 3d5ce043
......@@ -920,4 +920,63 @@ GRANT USAGE ON *.* TO `user3`@`%`
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO `user3`@`%`
DROP USER 'user3'@'%';
update mysql.db set Delete_history_priv='Y' where db like 'test%';
#
# 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/7: 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.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host 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
mysql.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
mtr
mtr.global_suppressions OK
mtr.test_suppressions OK
performance_schema
test
Phase 7/7: 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
......@@ -381,4 +381,17 @@ SHOW GRANTS FOR 'user3'@'%';
DROP USER 'user3'@'%';
update mysql.db set Delete_history_priv='Y' where db like 'test%';
--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/mysql_upgrade_info
--echo End of 10.3 tests
......@@ -27,7 +27,7 @@
set sql_mode='';
set storage_engine=MyISAM;
set enforce_storage_engine=NULL;
set alter_algorithm=DEFAULT;
set alter_algorithm='DEFAULT';
ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment