summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorChristian Gonzalez <gondchri@amazon.com>2022-11-28 21:20:23 +0000
committerDaniel Black <daniel@mariadb.org>2022-11-29 10:55:17 +1100
commit112870d7b406df38fc86f5ec09ae8c82733de4a9 (patch)
tree640c3c4c5eb0c9a2a3ea053e25b0274770e4bc0e /mysql-test
parent3d5ce0430bc224490dd2011c41bf05bc2e524ed0 (diff)
downloadmariadb-git-112870d7b406df38fc86f5ec09ae8c82733de4a9.tar.gz
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 0ee0868, 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.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/mysql_upgrade.result59
-rw-r--r--mysql-test/main/mysql_upgrade.test13
2 files changed, 72 insertions, 0 deletions
diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result
index 547bd8ae3b7..bde6893526e 100644
--- a/mysql-test/main/mysql_upgrade.result
+++ b/mysql-test/main/mysql_upgrade.result
@@ -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
diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test
index acc4fc31d65..5d8a89b08d4 100644
--- a/mysql-test/main/mysql_upgrade.test
+++ b/mysql-test/main/mysql_upgrade.test
@@ -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