Bug #34579 | Backup: Restore overwrites the new / modified data without warning | ||
---|---|---|---|
Submitted: | 15 Feb 2008 4:05 | Modified: | 1 Dec 2008 17:22 |
Reporter: | Hema Sridharan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Backup | Severity: | S2 (Serious) |
Version: | 6.0.5-alpha-debug | OS: | Linux |
Assigned to: | Jørgen Løland | CPU Architecture: | Any |
[15 Feb 2008 4:05]
Hema Sridharan
[15 Feb 2008 10:30]
Susanne Ebrecht
Many thanks for writing a bug report. Did you configure MySQL for incremental backup? You can find more informations about this here: http://dev.mysql.com/doc/refman/6.0/en/backup.html Please send your my.cnf too.
[20 Feb 2008 17:10]
Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products. The destructive nature of RESTORE is already noted in the documentation of the RESTORE statement. I will also add mention this in the section on backup limitations.
[5 Nov 2008 14:25]
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/57892 2727 Jorgen Loland 2008-11-05 Bug#34579 - Backup: Restore overwrites the new / modified data without warning Preliminary patch - should not be seen in any branch
[7 Nov 2008 10:52]
Jørgen Løland
PROPOSED SOLUTION ----------------- Add OVERWRITE flag to RESTORE command: "RESTORE DATABASE ... OVERWRITE" If one of the databases to be restored already exists and OVERWRITE is not specified, RESTORE command will fail with an error. Internally, the execute_backup_command and do_restore commands will get a new bool parameter with value extracted in the parser.
[7 Nov 2008 11:30]
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/58167 2727 Jorgen Loland 2008-11-07 Bug#34579 - Backup: Restore overwrites the new / modified data without warning Add OVERWRITE flag to RESTORE command Before, RESTORE would overwrite existing DBs with same name. With this patch, RESTORE will error if database exists and OVERWRITE is not specified.
[7 Nov 2008 23:51]
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/58167
[10 Nov 2008 8:54]
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/58294 2727 Jorgen Loland 2008-11-10 Bug#34579 - Backup: Restore overwrites the new / modified data without warning Add OVERWRITE flag to RESTORE command Before, RESTORE would overwrite existing DBs with same name. With this patch, RESTORE will error if database exists and OVERWRITE is not specified.
[17 Nov 2008 9:56]
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/58928 2734 Jorgen Loland 2008-11-17 Bug#34579 - Backup: Restore overwrites the new / modified data without warning Add OVERWRITE flag to RESTORE command Before, RESTORE would overwrite existing DBs with same name. With this patch, RESTORE will error if database exists and OVERWRITE is not specified.
[17 Nov 2008 10:40]
Rafal Somla
Good to push.
[17 Nov 2008 14:10]
Jørgen Løland
Pushed to mysql-6.0-backup
[20 Nov 2008 13:51]
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/59379 2740 Jorgen Loland 2008-11-20 Bug#34579 - Backup: Restore overwrites the new / modified data without warning Follow-up patch: Fix compile warning and cleanup iterator object in case of DBUG_RETURN
[20 Nov 2008 13:53]
Rafal Somla
Follow-up patch good to push.
[26 Nov 2008 8:51]
Bugs System
Pushed into 6.0.9-alpha (revid:jorgen.loland@sun.com-20081120135341-7yv79zrm60xwpesz) (version source revid:jorgen.loland@sun.com-20081126084449-lq9ckif3hmxesy1n) (pib:5)
[27 Nov 2008 8:31]
Jørgen Løland
Restore syntax: RESTORE FROM '<file>' [OVERWRITE]; Without OVERWRITE: If any of the databases to be restored already exists in the server, restore will abort with error code 1752. With OVERWRITE: Any database that will be restored that already exists in the server will be dropped before restoring. In other words, you loose everything that was in the database in the server but not in the backup image. ------------------------- mysql> create database t; Query OK, 1 row affected (0.00 sec) mysql> use t; Database changed mysql> create table t1 (i int); Query OK, 0 rows affected (0.00 sec) mysql> insert into t1 values (1); Query OK, 1 row affected (0.00 sec) mysql> backup database t to 't.bup'; +-----------+ | backup_id | +-----------+ | 272 | +-----------+ 1 row in set (0.14 sec) mysql> insert into t1 values (2); Query OK, 1 row affected (0.01 sec) mysql> select * from t1; +------+ | i | +------+ | 1 | | 2 | +------+ 2 rows in set (0.00 sec) mysql> restore from 't.bup'; ERROR 1752 (HY000): Database 't' already exists. Use OVERWRITE flag to overwrite. mysql> restore from 't.bup' overwrite; +-----------+ | backup_id | +-----------+ | 274 | +-----------+ 1 row in set (0.02 sec) mysql> select * from t1; +------+ | i | +------+ | 1 | +------+ 1 row in set (0.01 sec)
[1 Dec 2008 17:22]
Paul DuBois
Noted in 6.0.9 changelog. Previously, RESTORE overwrote any databases with information from the backup image. Now, RESTORE aborts with an error if the backup image contains any databases that currently exist on the server, unless the optional keyword OVERWRITE is given following the image filename.
[10 Dec 2008 5:41]
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/61141 2742 He Zhenxing 2008-12-10 [merge] Auto Merge