Commit ad94790f authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb

mysqlcheck tool can be used even if opt_systables_only is true
(to upgrade views from mysql - that overrides opt_systables_only)
parent 0a76ad5f
......@@ -1051,16 +1051,11 @@ int main(int argc, char **argv)
/* Find mysql */
find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name);
if (!opt_systables_only)
{
/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name);
}
else
{
if (!opt_silent)
printf("The --upgrade-system-tables option was used, databases won't be touched.\n");
}
if (opt_systables_only && !opt_silent)
printf("The --upgrade-system-tables option was used, user tables won't be touched.\n");
/*
Read the mysql_upgrade_info file to check if mysql_upgrade
......
......@@ -250,7 +250,7 @@ GRANT USAGE ON *.* TO 'user3'@'%'
GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%';
End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched.
The --upgrade-system-tables option was used, user tables won't be touched.
Phase 1/4: Fixing views... Skipped
Phase 2/4: Fixing table and database names ... Skipped
Phase 3/4: Checking and upgrading tables... Skipped
......
......@@ -266,4 +266,19 @@ master-bin.000001 # Query # # use `test`; REPAIR VIEW `v3` FROM MYSQL
master-bin.000001 # Query # # use `test`; REPAIR VIEW `v4` FROM MYSQL
drop table if exists kv;
drop view v1,v2,v3,v4;
rename table mysql.event to mysql.ev_bk;
flush tables;
The --upgrade-system-tables option was used, user tables won't be touched.
MySQL upgrade detected
Phase 1/4: Fixing views from mysql
test.v1 OK
test.v2 OK
test.v3 OK
Phase 2/4: Fixing table and database names ... Skipped
Phase 3/4: Checking and upgrading tables... Skipped
Phase 4/4: Running 'mysql_fix_privilege_tables'
OK
drop table mysql.event;
rename table mysql.ev_bk to mysql.event;
drop view v1,v2,v3;
drop table t1;
......@@ -157,5 +157,30 @@ rename table mysql.ev_bk to mysql.event;
drop table if exists kv;
drop view v1,v2,v3,v4;
drop table t1;
#
# MDEV-9453 mysql_upgrade.exe error when mysql is migrated to mariadb
# (mysql_upgrade.exe --upgrade-system-tables fails on fixing views)
#
# Make it look like a MySQL directory again
rename table mysql.event to mysql.ev_bk;
--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYI $MYSQLD_DATADIR/mysql/event.MYI
--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.MYD $MYSQLD_DATADIR/mysql/event.MYD
--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/event.frm $MYSQLD_DATADIR/mysql/event.frm
--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v1.frm $MYSQLD_DATADIR/test/v1.frm
--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v2.frm $MYSQLD_DATADIR/test/v2.frm
--copy_file $MYSQL_TEST_DIR/std_data/mysql_upgrade/v3.frm $MYSQLD_DATADIR/test/v3.frm
flush tables;
--replace_result $MYSQLTEST_VARDIR var
--exec $MYSQL_UPGRADE --force --upgrade-system-tables 2>&1
# back to mariadb default
drop table mysql.event;
rename table mysql.ev_bk to mysql.event;
drop view v1,v2,v3;
drop table t1;
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