Bug #33352 Backup:crash if I use old set of mysql files.
Submitted: 19 Dec 2007 3:15 Modified: 21 Oct 2008 17:35
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0.5-alpha OS:Linux (SUSE 10 64-bit)
Assigned to: Chuck Bell CPU Architecture:Any

[19 Dec 2007 3:15] Peter Gulutzan
Description:
I use the mysql-6.0-backup source.

If I installed with 5.0, and then I switch to 6.0,
BACKUP DATABASE crashes.

How to repeat:
With MySQL 5.0.54:
Clear out datadir, for example say
"
cd /usr/local/mysql/var
rm -R *
"
Then run mysql_install_db.

With MySQL 6.0.5:

Do not re-run mysql_install_db, or any 'upgrade' script.

linux:/home/pgulutzan # /usr/local/mysql/bin/mysql --user=root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> BACKUP DATABASE test TO 'a';
ERROR 2013 (HY000): Lost connection to MySQL server during query
[19 Dec 2007 13:43] MySQL Verification Team
Thank you for the bug report.

[miguel@amanhecer 6.0b]$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.5-alpha-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> BACKUP DATABASE test TO 'a';
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[3 Jan 2008 21:58] Chuck Bell
It appears that if the tables are not present, the locking thread goes squirrels and does not error like expected. Best to add code to check for existence of tables before a backup or restore.
[3 Jan 2008 22:34] 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/40543

ChangeSet@1.2754, 2008-01-03 17:31:10-05:00, cbell@mysql_cab_desk. +6 -0
  BUG#33352 : Backup:crash if I use old set of mysql files.
  
  Added capability to throw an error if either of the backup
  progress tables are missing.
[3 Jan 2008 22:35] Chuck Bell
Patch ready for review. See http://lists.mysql.com/commits/40543 .
[28 Jan 2008 16:18] 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/41317
[25 Feb 2008 20:19] Bugs System
Pushed into 6.0.5-alpha
[26 Feb 2008 13:11] Peter Gulutzan
There's still a tiny problem: suppose that I see the new error
messages and get it into my head that what I'm supposed to do
is create the tables. If I do that, I get a crash. For example:

mysql> restore from '1';
ERROR 1146 (42S02): Table 'mysql.online_backup' doesn't exist

mysql> create table mysql.online_backup (s1 int);
Query OK, 0 rows affected (0.05 sec)

mysql> restore from '1';
ERROR 1146 (42S02): Table 'mysql.online_backup_progress' doesn't exist

mysql> create table mysql.online_backup_progress (s1 int);
Query OK, 0 rows affected (0.11 sec)

mysql> restore from '1';
ERROR 2013 (HY000): Lost connection to MySQL server during query

If it's decided that this is acceptable nonsense, just change
status back to "Need Doc Info".
[15 Sep 2008 19:01] Chuck Bell
Under the new backup logs work (see WL#4296), the above scenario will not result in a crash however, nothing will be written to the (incorrectly configured) backup logs.
[15 Sep 2008 19:34] Chuck Bell
The actions shown above are not normal user responses. Suggest modifying the error message so that the user gets a hint as to how to fix the problem. 

Example:

mysql> use mysql;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| backup_history            |
| backup_progress           |
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
| x                         |
+---------------------------+
26 rows in set (0.02 sec)

mysql> drop table backup_history;
Query OK, 0 rows affected (0.00 sec)

mysql> drop table backup_progress;
Query OK, 0 rows affected (0.00 sec)

mysql> backup database test to 't1.bak';
ERROR 1667 (HY000): Can't open the backup logs as tables. Check 'mysql.backup_hi
story' and 'mysql.backup_progress' or run mysql_upgrade to repair.
mysql>
[16 Sep 2008 18:13] 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/54223

2694 Chuck Bell	2008-09-16
      BUG#33352 Backup:crash if I use old set of mysql files. 
      
      The error message produced when the backup logs are missing or damaged is
      misleading. This patch changes the error to a more appropriate, instructional
      error message.
[21 Sep 2008 13:52] Øystein Grøvlen
Approved given that the change in mtr_report.pl is made according to the review.
[29 Sep 2008 6:45] Rafal Somla
Good to push.
[29 Sep 2008 18:42] 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/54691

2696 Chuck Bell	2008-09-29
      BUG#33352 Backup:crash if I use old set of mysql files. 
      
      The error message produced when the backup logs are missing or damaged is
      misleading. This patch changes the error to a more appropriate, instructional
      error message.
[29 Sep 2008 18:45] 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/54692

2696 Chuck Bell	2008-09-29
      BUG#33352 Backup:crash if I use old set of mysql files. 
      
      The error message produced when the backup logs are missing or damaged is
      misleading. This patch changes the error to a more appropriate, instructional
      error message.
[17 Oct 2008 17:24] Bugs System
Pushed into 6.0.8-alpha  (revid:cbell@mysql.com-20080929184159-1kilvuzcrqjkxb1s) (version source revid:oystein.grovlen@sun.com-20080930094956-3qxly6h7nyc2r253) (pib:5)
[20 Oct 2008 18:29] Chuck Bell
The original problem was if the backup tables in the mysql database were deleted and/or recreated incorrectly, the system crashed. 

This problem was made absolete when the new backup logs work was pushed. Although the system no longer crashed, the error message presented did not give the user enough information to know what was wrong. The last patch for this bug report issues a clearer error message.
[21 Oct 2008 17:35] Paul DuBois
Noted in 6.0.8 changelog.

The server crashed for BACKUP DATABASE if the backup progress tables
in the mysql database were missing or created incorrectly.