Bug #30487 mysql_upgrade reports misleading errors
Submitted: 18 Aug 2007 3:32 Modified: 27 Aug 2007 11:27
Reporter: Omer BarNir
Status: Verified
Category:Server: Installing Severity:S3 (Non-critical)
Version:5.1.21 OS:Any
Assigned to: Jonathan Perkin Target Version:
Tags: pushbuild, test failure, sporadic
Triage: Triaged: D4 (Minor)

[18 Aug 2007 3:32] Omer BarNir
Description:
When upgrading from 5.0 to 5.1 the user s required to run 'mysql_upgrade' in order to
check and update the system tables.
mysql_upgrade calls mysql_check (that checks that tables are ok) and then calls
mysql_fix_privileges_tables.

During the initial run, if the server is started with the --output=table option
mysql_check reports errors related to 'mysql.general_log' not being present 

omer@linux:~/beta-5.1.21/mysql-test> ../bin/mysql_upgrade
--datadir=/tmp/omer_var/master-data --basedir=home/omer/beta-5.1.21 --force
--socket=/tmp/omer_var/tmp/master.sock --port=9306 --user=root
Looking for 'mysql' in: /home/omer/beta-5.1.21/bin/mysql
Looking for 'mysqlcheck' in: /home/omer/beta-5.1.21/bin/mysqlcheck
Running 'mysqlcheck'...
mysql.columns_priv
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.db
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.func
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.help_category
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.help_keyword
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.help_relation
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.help_topic
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.host
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.proc
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.procs_priv
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.tables_priv
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.time_zone
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.time_zone_leap_second
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.time_zone_name
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.time_zone_transition
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.time_zone_transition_type
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
mysql.user
Error    : Table 'mysql.general_log' doesn't exist
status   : OK
Running 'mysql_fix_privilege_tables'...
OK
omer@linux:~/beta-5.1.21/mysql-test>

A second run will not report any errors (since now the table already exists (created
while running 'mysql_fix_privilege_tables' in the first run)

omer@linux:~/beta-5.1.21/mysql-test>../bin/mysql_upgrade
--datadir=/tmp/omer_var/master-data --basedir=home/omer/beta-5.1.21 --force
--socket=/tmp/omer_var/tmp/master.sock --port=9306 --user=root
Looking for 'mysql' in: /home/omer/beta-5.1.21/bin/mysql
Looking for 'mysqlcheck' in: /home/omer/beta-5.1.21/bin/mysqlcheck
Running 'mysqlcheck'...
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log
Error    : You can't use locks with log tables.
status   : 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.servers                                      OK
mysql.slow_log
Error    : You can't use locks with log tables.
status   : 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
Running 'mysql_fix_privilege_tables'...
OK
omer@linux:~/beta-5.1.21/mysql-test>

How to repeat:
1) start a 5.0 system
2) Stop the system and start a 5.1 system pointing to the same database 
   (make sure the server is started with --log-output=table (or file,table)
3) Run the 'mysql_upgrade' command

Suggested fix:
This either needs to be fixed or documented to the users that the above error while
running mysql_upgrade (when upgrading from a 5.0 or previous system) is harmless.
Otherwise users might think there is something wrong with their upgrade
[27 Aug 2007 11:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33134

ChangeSet@1.2572, 2007-08-27 11:27:03+02:00, msvensson@pilot.(none) +1 -0
  Bug#30487 mysql_upgrade reports misleading errors
   - Update result file to include these "misleading errors", better to 
  run mysql_upgrade with them than not at all.
[4 Sep 2007 19:11] Bugs System
Pushed into 5.1.23-beta