Bug #41843 Can not do backup to a named pipe on windows
Submitted: 3 Jan 2009 19:36 Modified: 25 Feb 2010 0:30
Reporter: Tomas Dalebjörk Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Backup Severity:S3 (Non-critical)
Version:6.0.8 OS:Windows
Assigned to: Chuck Bell CPU Architecture:Any
Tags: Backup, MySQL, namedpipe

[3 Jan 2009 19:36] Tomas Dalebjörk
Description:
I am trying to backup to a named pipe on windows, but I got the following error..

 mysql@test:dbwriter:command:mysql --user=root --database=test < "C:\Program Files\repostor\Data Protector for MySQL\tmp\test"
ERROR 1632 (HY000) at line 1: Can't write to backup location '\\.\pipe\test' (file already exists?)
  mysql@ktest:dbwriter:end rc=1

This works perfectly when I done this with the "mysqldump > \\.\pipe\test" command, so there is nothing wrong with the named-pipe.

maybee you can apply the similare fix for Windows as for the bug below on UNIX...

Bug #37012  	Online backup: Can't backup to a pipe.

Regards Tomas

How to repeat:
1) Create a NamedPipe in windows.
2) logon to MySQL
3) execute : "backup database test to '\\\\.\\pipe\\test';

Suggested fix:
do not care if a file exist, overwrite the file, or add and argument to the backup command in mysql.
[5 Jan 2009 11:13] MySQL Verification Team
The support of Windows named pipes is broken, see bug: http://bugs.mysql.com/bug.php?id=41860.
[5 Jan 2009 14:02] Tomas Dalebjörk
I dont understand?
The command below mentioned in the bug, shows:

mysql> show variables like "%pipe%";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| named_pipe    | OFF   |
+---------------+-------+
1 row in set (0.03 sec)

mysql>

What you are saying is that NamedPipes are not supported in MySQL on windows platform?
How about backup the database to standard output.?
[12 Jan 2009 14:34] Susanne Ebrecht
Verified as described.
[19 Jan 2009 21:17] Tomas Dalebjörk
can you please explain.
Is it possinle to do backup on windows to named pipe?
or not?
if so; are there any parameter I need to set to get this to work?
[21 Jan 2009 21:09] Chuck Bell
May be related to BUG#40975.
[22 Sep 2009 17:36] Chuck Bell
Confirmed that the problem has not been fixed. Backup cannot send data to a Windows named pipe server.
[22 Sep 2009 18:11] Chuck Bell
There appears to be a problem in how the backup path resolution handles the Windows pipe name. It is changing '\\.\pipe\namedpipe' to '\\pipe\namedpipe' which is a file path, not a named pipe in Windows.
[22 Sep 2009 18:23] Chuck Bell
Confirmed. The problem is in the safe_cleanup_cat_path() method.
[22 Sep 2009 18:45] Chuck Bell
For debugging or development testing, one can use the named pipe server code depicted here:

http://msdn.microsoft.com/en-us/library/aa365601%28VS.85%29.aspx
[22 Sep 2009 20:43] Tomas Dalebjörk
Okey,
Are you planning to fix this problem?
repostors desing is based on namedpipes.

regards Tomas
[23 Sep 2009 19:05] Chuck Bell
Yes, an 'in progress' status indicates it will be fixed. ;)

Also, there is a workaround. For piping to named pipes on the local host -- which \\.\pipe\namedpipe indicates, one can use: \\localhost\pipe\namedpipe and the backup code will work correctly. For example:

BACKUP DATABASE x TO '\\\\localhost\\pipe\\namedpipe';

Thus, the fix for this bug will be such that \\.\pipe is recognized as a named pipe (iff on windows) and the period is not removed.
[23 Sep 2009 19:24] Chuck Bell
Note: While the fix for the bug is easy, creating a genuine test will be a bit more difficult. One possibility is to write a console application that can consume or produce a backup image file. For example:

winpipebackup [--SEND 'backup_image_file' | --RECEIVE 'backup_image_file']

A tool like this would allow test cases like:

- backup to named pipe and restore result using file-based restore
- restore from named pipe 

...
[5 Oct 2009 19:26] Chuck Bell
No test cases for MTR tests shall be created with this patch. WL#5107 is designed to permit testing of using named pipes on Windows.
[5 Oct 2009 19:31] 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/85793

2874 Chuck Bell	2009-10-05
      BUG#41843 : Can not do backup to a named pipe on windows
      
      The system currently interprets '\\.\pipe\namedpipe' as a fixed
      path translated to 'pipe\namedpipe' which is not a valid
      named pipe on windows. The path in question is a valid 
      representation of '\\localhost\pipe\namedpipe' and therefore
      should be preserved.
      
      This patch preserves the path notation.
     @ mysys/mf_pack.c
        Preserve the \\.\ at the start of the path.
     @ unittest/mysys/safe_cleanup_cat_path-t.c
        Added unit test cases for paths that form a named pipe including
        a test for the specific failure described in the bug report.
[9 Oct 2009 9:11] Rafal Somla
Approved, pending changes.
[15 Oct 2009 14: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/86995

2874 Chuck Bell	2009-10-15
      BUG#41843 : Can not do backup to a named pipe on windows
      
      The system currently interprets '\\.\pipe\namedpipe' as a fixed
      path translated to 'pipe\namedpipe' which is not a valid
      named pipe on windows. The path in question is a valid 
      representation of '\\localhost\pipe\namedpipe' and therefore
      should be preserved.
      
      This patch preserves the path notation.
     @ mysys/mf_pack.c
        Preserve the \\.\ sequence in the path.
     @ unittest/mysys/safe_cleanup_cat_path-t.c
        Added unit test cases for paths that form a named pipe including
        a test for the specific failure described in the bug report.
[15 Oct 2009 15: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/87006

2881 Chuck Bell	2009-10-15
      BUG#41843 : Can not do backup to a named pipe on windows
      
      The system currently interprets '\\.\pipe\namedpipe' as a fixed
      path translated to 'pipe\namedpipe' which is not a valid
      named pipe on windows. The path in question is a valid 
      representation of '\\localhost\pipe\namedpipe' and therefore
      should be preserved.
      
      This patch preserves the path notation.
     @ mysys/mf_pack.c
        Preserve the \\.\ sequence in the path.
     @ unittest/mysys/safe_cleanup_cat_path-t.c
        Added unit test cases for paths that form a named pipe including
        a test for the specific failure described in the bug report.
[20 Feb 2010 9:17] Bugs System
Pushed into 6.0.14-alpha (revid:ingo.struewing@sun.com-20100218152520-s4v1ld76bif06eqn) (version source revid:ingo.struewing@sun.com-20100119103538-wtp5alpz4p2jayl5) (merge vers: 6.0.14-alpha) (pib:16)
[25 Feb 2010 0:30] Paul DuBois
Noted in 6.0.14 changelog.

On Windows, BACKUP DATABASE to a named pipe did not work.