Bug #35230 Backup: no backupdir
Submitted: 11 Mar 2008 21:11 Modified: 2 Sep 2008 19:06
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0.5-alpha-debug OS:Linux (SUSE 10 | 32-bit)
Assigned to: Chuck Bell CPU Architecture:Any
Triage: D2 (Serious)

[11 Mar 2008 21:11] Peter Gulutzan
Description:
The file name for BACKUP DATABASE and RESTORE statements
is relative to datadir. This is unworkable.
Backup names might conflict with database names,
file access privileges might be insufficient,
and we should encourage users to keep databases
and backups in separate areas. 

The agreed plan was to have a new global variable, backupdir.
By default it is the same as datadir.
But users can change it.

I don't see @@backupdir.

How to repeat:
SELECT @@backupdir;
[11 Mar 2008 21:49] Miguel Solorzano
Thank you for the bug report.
[17 Jun 2008 11:34] Chuck Bell
This bug report is being satisfied as part of WL#4296.
[21 Jun 2008 20:43] 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/48287

2638 Chuck Bell	2008-06-21
      This worklog changes the existing backup progress mechanism from MyISAM
      tables to logging capability similar to the query log. The new mechanism
      allows users to specify the destination of the log as a file, table, both,
      and allows users to turn the logs on or off.
[24 Jun 2008 15:28] 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/48397

2638 Chuck Bell	2008-06-24
      WL#4296 : Online Backup : Refine backup progress mechanism
      
      This worklog changes the existing backup progress mechanism from MyISAM
      tables to logging capability similar to the query log. The new mechanism
      allows users to specify the destination of the log as a file, table, both,
      and allows users to turn the logs on or off.
[25 Jun 2008 21:29] 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/48539

2638 Chuck Bell	2008-06-25
      WL#4296 : Online Backup : Refine backup progress mechanism
      
      This worklog changes the existing backup progress mechanism from MyISAM
      tables to logging capability similar to the query log. The new mechanism
      allows users to specify the destination of the log as a file, table, both,
      and allows users to turn the logs on or off.
[2 Jul 2008 19:38] 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/48907

2648 Chuck Bell	2008-07-02
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path where the image files
      are placed (backup) or accessed (restore) if a path is not specified in the command.
      
      The default is the same as --datadir.
[2 Jul 2008 19:40] Chuck Bell
New patch committed per Rafal's request.

http://lists.mysql.com/commits/48907
[8 Jul 2008 13:09] 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/49175

2648 Chuck Bell	2008-07-08
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
      
      The default is the same as --datadir.
[8 Jul 2008 13:41] Chuck Bell
New patch added that removes dependency on system variable. Other smaller corrections include use of String class and removal of access to THD object.

http://lists.mysql.com/commits/49175
[9 Jul 2008 17:32] 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/49334

2648 Chuck Bell	2008-07-09
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[9 Jul 2008 19:09] 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/49350

2648 Chuck Bell	2008-07-09
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[10 Jul 2008 14:02] 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/49454

2648 Chuck Bell	2008-07-10
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
      
      Note: Patch 1 of 2 containing changes to server code. Patch 2 is needed
      for complete implement.
[25 Jul 2008 18:59] Chuck Bell
Changed status due to possible new features or behaviour changes. Meeting to discuss: TBD after 29 July (Peter returns).
[29 Jul 2008 18:30] Chuck Bell
29 July 2008 DESIGN DISCUSSION

1. Is the backupdir variable read-only or dynamic? Startup option?

   DECISION: Dynamic and startup.

2. Should the server validate the directory specified if used 
   as a startup option?

   DECISION: Issue warning on startup if backupdir is invalid.

3. Should the server validate the directory specified if the value
   is changed at runtime (@@global.backupdir=)?

   DECISION: Directory is validated at runtime when set. Warning issued
   if directory is invalid (does not exist or no rights to access)

4. If a relative path is specified, say BACKUP DATABASE ... TO
   '../something', should this be relative to the value of
   backupdir or the current working directory (which is == datadir)?

   DECISION: Relative paths entered in backup commands are relative 
   to backupdir.

5. Should a backup operation warn or error if backupdir is invalid?

   DECISION:
     - If backupdir is not used, then no check is done.
     - If the fully qualified path is invalid, then we error.
     - We already check backupdir variable when it is set and
       at startup, so we will not check it again when executing
       BACKUP/RESTORE.

6. If we elect to warn when an invalid backupdir value is detected
   at backup, should it write the image file to the working directory?
   What about restore? Should it search for the file on the current
   working directory and if found use that file?

   DECISION: We don't "fail-over" to other directories.
[31 Jul 2008 19:32] 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/50798

2674 Chuck Bell	2008-07-31
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[1 Aug 2008 10:06] Lars Thalmann
On Fri, Aug 01, 2008 at 11:59:30AM +0200, Shane Bester wrote:
> This @@backupdir must be at least tested like this:
>
> set global/session @@backupdir='?'
>
> where '?' is random garbage as well as short, long, impossible, possible
> paths.
>
> It should be done concurrently in 50 threads before and during a
> backup/restore
> It should be done under various ddl and dml high load and make sure it's
> safe to be set dynamically.
[1 Aug 2008 20:43] 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/50829

2674 Chuck Bell	2008-08-01
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[4 Aug 2008 19: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/50884

2674 Chuck Bell	2008-08-04
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[5 Aug 2008 7:45] Jørgen Løland
Good to push
[8 Aug 2008 15:44] 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/51204

2675 Chuck Bell	2008-08-08 [merge]
      Merge in new code from repository prior to push of BUG#35230.
[8 Aug 2008 15:46] Chuck Bell
Patch queued.
[8 Aug 2008 17:22] 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/51211

2680 Chuck Bell	2008-08-08
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[8 Aug 2008 17:23] 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/51212

2680 Chuck Bell	2008-08-08
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[8 Aug 2008 17: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/51213

2680 Chuck Bell	2008-08-08
      BUG#35230 Backup: no backupdir 
      
      This patch adds the dynamic variable --backupdir which specifies the path
      where the image files are placed (backup) or accessed (restore) if a path
      is not specified in the command.
[25 Aug 2008 20:59] Chuck Bell
Released in 6.0.7
[2 Sep 2008 19:06] Paul Dubois
Noted in 6.0.7 changelog.

A new system variable, backupdir, enables the default directory to be
specified for BACKUP DATABASE and RESTORE operations when the image
file pathname is not a full pathname. The default value for this 
variable is the data directory.
[14 Sep 2008 0:29] Bugs System
Pushed into 6.0.7-alpha  (revid:cbell@mysql.com-20080808172131-p9hombq7ffit8s33) (version source revid:vvaintroub@mysql.com-20080804094710-jb2qpqxpf2ir2gf3) (pib:3)