diff options
author | Alexey Botchkov <holyfoot@mysql.com> | 2009-10-28 14:02:00 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@mysql.com> | 2009-10-28 14:02:00 +0400 |
commit | 05ddc34be8f59f93da53f6e8ebc9fa0de71abcac (patch) | |
tree | 104d642cdfe674f13f48fb605a7127cd1b94f2f2 | |
parent | 273a0a4f97ea07620675cba1f61e84dd83c21a2f (diff) | |
download | mariadb-git-05ddc34be8f59f93da53f6e8ebc9fa0de71abcac.tar.gz |
WL#4991 mysql_upgrade --fix-privilege-tables
(backport)
mysql_upgrade script accepts --upgrade-system-tables option,
fixing only system tables in this case.
per-file comments:
client/mysql_upgrade.c
WL#4991 mysql_upgrade --fix-privilege-tables
--upgrade-system-tables option added.
if it is set, the tool won't look for the mysqlcheck then
run_mysqlcheck_fixnames() and run_mysqlcheck_upgrade won't be called.
mysql-test/r/mysql_upgrade.result
WL#4991 mysql_upgrade --fix-privilege-tables
test result added
mysql-test/t/mysql_upgrade.test
WL#4991 mysql_upgrade --fix-privilege-tables
test case added
-rw-r--r-- | client/mysql_upgrade.c | 22 | ||||
-rw-r--r-- | mysql-test/r/mysql_upgrade.result | 4 | ||||
-rw-r--r-- | mysql-test/t/mysql_upgrade.test | 6 |
3 files changed, 27 insertions, 5 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 52c3636219d..05eb80e5455 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -34,7 +34,8 @@ static char mysql_path[FN_REFLEN]; static char mysqlcheck_path[FN_REFLEN]; -static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag; +static my_bool opt_force, opt_verbose, debug_info_flag, debug_check_flag, + opt_systables_only; static uint my_end_arg= 0; static char *opt_user= (char*)"root"; @@ -121,6 +122,10 @@ static struct my_option my_long_options[]= #include <sslopt-longopts.h> {"tmpdir", 't', "Directory for temporary files", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"upgrade-system-tables", 's', "Only upgrade the system tables " + "do not try to upgrade the data.", + (uchar**)&opt_systables_only, (uchar**)&opt_systables_only, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"user", 'u', "User for login if not current user.", (uchar**) &opt_user, (uchar**) &opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"verbose", 'v', "Display more output about the process", @@ -838,8 +843,15 @@ int main(int argc, char **argv) /* Find mysql */ find_tool(mysql_path, IF_WIN("mysql.exe", "mysql"), self_name); - /* Find mysqlcheck */ - find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); + if (!opt_systables_only) + { + /* Find mysqlcheck */ + find_tool(mysqlcheck_path, IF_WIN("mysqlcheck.exe", "mysqlcheck"), self_name); + } + else + { + printf("The --upgrade-system-tables option was used, databases won't be touched.\n"); + } /* Read the mysql_upgrade_info file to check if mysql_upgrade @@ -856,8 +868,8 @@ int main(int argc, char **argv) /* Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" */ - if (run_mysqlcheck_fixnames() || - run_mysqlcheck_upgrade() || + if ((!opt_systables_only && + (run_mysqlcheck_fixnames() || run_mysqlcheck_upgrade())) || run_sql_fix_privilege_tables()) { /* diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result index 384442f8c31..3ff4c1eba64 100644 --- a/mysql-test/r/mysql_upgrade.result +++ b/mysql-test/r/mysql_upgrade.result @@ -127,3 +127,7 @@ mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.user OK set GLOBAL sql_mode=default; +Looking for 'mysql' as: /home/hf/work/mysql_common/wl4991/client/mysql +The --upgrade-system-tables option was used, databases won't be touched. +Running 'mysql_fix_privilege_tables'... +OK diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test index d1f97d7287e..7bf329744a2 100644 --- a/mysql-test/t/mysql_upgrade.test +++ b/mysql-test/t/mysql_upgrade.test @@ -89,3 +89,9 @@ DROP USER mysqltest1@'%'; set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE'; --exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 eval set GLOBAL sql_mode=default; + +# +# Test the --upgrade-system-tables option +# +--exec $MYSQL_UPGRADE --upgrade-system-tables + |