Commit 4df195a4 authored by Nirbhay Choubey's avatar Nirbhay Choubey

Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH

                    OPTION SKIP-WRITE-BINLOG

System tables were not getting upgraded when
mysql_upgrade was run with --skip-write-binlog
option. (Same for --write-binlog.) Also, with
this option, mysql_upgrade_info file was not
getting created after the upgrade.

mysql_upgrade makes use of mysql client tool in
order to run upgrade scripts, while doing so it
passes some of the command line options (used to
start mysql_upgrade) directly to mysql client.
The reason behind this bug being, some options
like skip-write-binlog and upgrade-system-tables
were being passed to mysql tool along with other
options, and hence mysql execution failed due
presence of these invalid options.

Fixed this issue by filtering out the above mentioned
options from the list of options that will be passed to
mysql and mysqlcheck tools. However, since --write-binlog
is supported by mysqlcheck, this option would be used
explicitly while running mysqlcheck. (not part of patch,
already there)

Checking the contents of general log after the upgrade
is not doable via an mtr test. So performed manual test.
Added a test to verify the creation of mysql_upgrade_info.


client/mysql_upgrade.c:
  Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH
                      OPTION SKIP-WRITE-BINLOG
  
  With this patch, --upgrade-system-tables and
  --write-binlog options will not be added to the
  list of options, used to start mysql and mysqlcheck
  tools.
mysql-test/r/mysql_upgrade.result:
  Added a testcase for Bug#11827359.
mysql-test/t/mysql_upgrade.test:
  Added a testcase for Bug#11827359.
parent 38138943
...@@ -286,6 +286,8 @@ get_one_option(int optid, const struct my_option *opt, ...@@ -286,6 +286,8 @@ get_one_option(int optid, const struct my_option *opt,
case 'v': /* --verbose */ case 'v': /* --verbose */
case 'f': /* --force */ case 'f': /* --force */
case 's': /* --upgrade-system-tables */
case OPT_WRITE_BINLOG: /* --write-binlog */
add_option= FALSE; add_option= FALSE;
break; break;
......
...@@ -194,3 +194,36 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' ...@@ -194,3 +194,36 @@ GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
DROP USER 'user3'@'%'; DROP USER 'user3'@'%';
End of 5.1 tests End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched. The --upgrade-system-tables option was used, databases won't be touched.
#
# Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
# SKIP-WRITE-BINLOG
#
# Droping the previously created mysql_upgrade_info file..
# Running mysql_upgrade with --skip-write-binlog..
mtr.global_suppressions OK
mtr.test_suppressions OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log 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.user OK
End of tests
...@@ -102,5 +102,24 @@ DROP USER 'user3'@'%'; ...@@ -102,5 +102,24 @@ DROP USER 'user3'@'%';
# Test the --upgrade-system-tables option # Test the --upgrade-system-tables option
# #
--replace_result $MYSQLTEST_VARDIR var --replace_result $MYSQLTEST_VARDIR var
--exec $MYSQL_UPGRADE --skip-verbose --upgrade-system-tables --exec $MYSQL_UPGRADE --skip-verbose --force --upgrade-system-tables
--echo #
--echo # Bug#11827359 60223: MYSQL_UPGRADE PROBLEM WITH OPTION
--echo # SKIP-WRITE-BINLOG
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
--echo # Droping the previously created mysql_upgrade_info file..
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo # Running mysql_upgrade with --skip-write-binlog..
--replace_result $MYSQLTEST_VARDIR var
--exec $MYSQL_UPGRADE --skip-verbose --skip-write-binlog
# mysql_upgrade must have created mysql_upgrade_info file,
# so the following command should never fail.
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo End of tests
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