Bug #52994 | Tables are lost when db is dropped after backup and restore performed using IHB | ||
---|---|---|---|
Submitted: | 20 Apr 2010 16:20 | Modified: | 20 Apr 2010 21:27 |
Reporter: | Hema Sridharan | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Enterprise Backup | Severity: | S3 (Non-critical) |
Version: | OS: | Any | |
Assigned to: | Pekka Lampio | CPU Architecture: | Any |
[20 Apr 2010 16:20]
Hema Sridharan
[20 Apr 2010 16:28]
Hema Sridharan
Output of Innobackup and datadir files
Attachment: IHB_innobkp.txt (text/plain), 8.01 KiB.
[20 Apr 2010 16:30]
Hema Sridharan
The innobackup executed with --apply-log and its output is placed inthe below file
Attachment: IHB_applylog.txt (text/plain), 5.33 KiB.
[20 Apr 2010 16:31]
Hema Sridharan
The innobackup with --copy-back option
Attachment: IHB_copyback.txt (text/plain), 4.81 KiB.
[20 Apr 2010 17:07]
Mikhail Izioumtchenko
Hema, mysqld should be shut down before copyback, then restarted after the copyback. Please reproduce with mysqld restart as above, and provide the following information: - stdout/stderr for both mysqld instances - mysqld datadir before and after mysqld restart
[20 Apr 2010 17:29]
Hema Sridharan
When I shutdown mysqld, restart the server, then do innobackup --copy-back. I see the following in the mysql client mysql> show databases like 'db%'; +----------------+ | Database (db%) | +----------------+ | db1 | | db2 | +----------------+ 2 rows in set (0.00 sec) mysql> show tables from db1; +---------------+ | Tables_in_db1 | +---------------+ | t1 | +---------------+ 1 row in set (0.00 sec) mysql> show tables from db2; +---------------+ | Tables_in_db2 | +---------------+ | t2 | +---------------+ 1 row in set (0.00 sec) mysql> select * from db1.t1; ERROR 1146 (42S02): Table 'db1.t1' doesn't exist mysql> select * from db2.t2; ERROR 1146 (42S02): Table 'db2.t2' doesn't exist We can notice that tables are missing from db1 and db2 when we restart the server and then apply --copy-back option with innobackup The mysqld.1.err output is attached in the file.
[20 Apr 2010 17:32]
Hema Sridharan
This file contains the datadir contents and mysqd.err
Attachment: mysqld.1.err (application/octet-stream, text), 5.99 KiB.
[20 Apr 2010 17:39]
Mikhail Izioumtchenko
Hema, to quote from you: When I shutdown mysqld, restart the server, then do innobackup --copy-back. I see the following in the mysql client We can notice that tables are missing from db1 and db2 when we restart the server and then apply --copy-back option with innobackup This is wrong. mysqld shouldn't be running when you perform copy-back: shutdown mysqld copy-back restart mysqld please perform the actions above, providing output at least for the second mysqld and the copyback, backup dir contents, and three instances of datadir contents: after shutdown but before copyback; after copyback but before mysqld restart; after restart when you see the problem. If we still see commands copying the .ibd files for missing tables after that, but no tables after the copy, could you rerun the 'cp' commands manually to see if the copy is actually taking place?
[20 Apr 2010 17:42]
Mikhail Izioumtchenko
please also post .cnf file for mysqld you start on the restored database.
[20 Apr 2010 20:11]
Mikhail Izioumtchenko
I would be very interesting to see how we lose the data because this is the standard procedure of using HB: <ima> 1. backup copies data and log files to the backup directory. This is more than just copy. <ima> 2. apply log applies redo log in the backup directory. It neither reads nor writes mysqld data directory and doesn't care if mysqld is running or not <ima> 3. shutdown mysqld <ima> 4. copy-back is plain copy, you might as well perform cp -pR. This will be our next experiment <ima> 5. restart mysqld. It does yet another recovery and most importantly rolls back incomplete transactions *** sunny|away is now known as sunny <ima> 6. restore is now done, enjoy this is both obvious and documented: a- you can't have mysqld writing over the same files that are being copied by copyback b- after the copyback you restart musqld, otherwise we can't use the database, can we? so please reproduce following this procedure, otherwise it's not a bug. As for the files: - mysqld .cnf file(s) - mysqld stdout/stderr from both instances (cd directory; ls -laR `pwd`) for the following: data directory before backup data directory after backup backup directory after backup backup directory after apply data directory after mysqld shutdown but before copyback data directory after the copyback but before mysqld startup data directory after mysqld startup since we would seem to have a good backup already, we could start with this small test: <ima> 3. shutdown mysqld <ima> 4. copy-back is plain copy, you might as well perform cp -pR. This will be our next experiment <ima> 5. restart mysqld. It does yet another recovery and most importantly rolls back incomplete transactions *** sunny|away is now known as sunny <ima> 6. restore is now done, enjoy with mysqld .cnf and stdout/stderr and backup directory before copyback data directory after mysqld shutdown but before copyback data directory after the copyback but before mysqld startup data directory after mysqld startup Please follow the instructions to the letter, I believe we've spent enough time on this already besides there may be still a problem out there. Failure to shutdown mysqld doesn't easily explain the lack of the .ibd file. But we need to do things right first.
[20 Apr 2010 20:38]
Mikhail Izioumtchenko
<hema> ima: yes ./mtr wipes out everything and that is what I mentioned in my bug report <ima> ok, I thought the restart was by a conventional mysqld ..... the problem is, mysqld is started with mtr which wipes out the database. copy-back in fact appears to be working. Hema and I are working on it.
[20 Apr 2010 21:27]
Mikhail Izioumtchenko
after painstakingly starting the server from the command line, everything works. So the problem is how to start mysqld without wiping up the database with mtr (mysql-test-run.pl --start-dirty?) but it does look like there's no bug in ibbackup.
[20 Apr 2010 21:40]
Hema Sridharan
But we need to find a way to execute the tests in MySQL test framework as well.