diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-02-04 14:47:46 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-02-06 11:45:23 +0100 |
commit | ad94790f468bacb2cd62d02d3a6e7f012ca72e65 (patch) | |
tree | 6b4a062758539aa1078396e681ed843726442242 | |
parent | 0a76ad5ffd04fdfdf77435f4c9e733c2a59a14d8 (diff) | |
download | mariadb-git-ad94790f468bacb2cd62d02d3a6e7f012ca72e65.tar.gz |
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)
-rw-r--r-- | client/mysql_upgrade.c | 15 | ||||
-rw-r--r-- | mysql-test/r/mysql_upgrade.result | 2 | ||||
-rw-r--r-- | mysql-test/r/mysql_upgrade_view.result | 15 | ||||
-rw-r--r-- | mysql-test/t/mysql_upgrade_view.test | 27 |
4 files changed, 47 insertions, 12 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 0be8f91af59..bc9b3c5b149 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -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"); - } + /* Find mysqlcheck */ + find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); + + 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 diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 5f81ee567f1..49adac312cd 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -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 diff --git a/mysql-test/r/mysql_upgrade_view.result b/mysql-test/r/mysql_upgrade_view.result index fa0ea5e3e64..fc174e9cfd1 100644 --- a/mysql-test/r/mysql_upgrade_view.result +++ b/mysql-test/r/mysql_upgrade_view.result @@ -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; diff --git a/mysql-test/t/mysql_upgrade_view.test b/mysql-test/t/mysql_upgrade_view.test index 7a098aa701b..c98c88f840e 100644 --- a/mysql-test/t/mysql_upgrade_view.test +++ b/mysql-test/t/mysql_upgrade_view.test @@ -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; |