Bug #60001 Backup image to pipe fails for MEB
Submitted: 8 Feb 2011 4:31 Modified: 23 Jun 2011 21:42
Reporter: Hema Sridharan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Enterprise Backup Severity:S3 (Non-critical)
Version:MEB 3.6 OS:Any (Linux, Mac OS X)
Assigned to: Thava Alagu CPU Architecture:Any

[8 Feb 2011 4:31] Hema Sridharan
Description:
Use backup-to-image command of MEB to backup to pipe.
But it fails giving an error as 
mysqlbackup: Error writing file 'UNKNOWN' (Errcode: 9)
 mysqlbackup: ERROR: Problem encountered while adding file header to backup image.
  Component file path: ibdata1
 mysqlbackup: ERROR: Problem encountered while trying to add file to backup image.
  Component file path: ibdata1
 mysqlbackup: ERROR: Writing to data file /export/home2/tmp/meb-dir/ibdata1 failed!

How to repeat:
mkfifo bak_pipe
chmod 666 bak_pipe

./mysqlbackup  --datadir=/export/home2/tmp/mysql-5.1-meb-testing/mysql-test/var/mysqld.1/data/  --innodb_log_file_size=5M --innodb_log_files_in_group=4 --backup_innodb_log_files_in_group=4 --backup_innodb_log_file_size=5M --innodb_data_home_dir=/export/home2/tmp/mysql-5.1-meb-testing/mysql-test/var/mysqld.1/data/ --backup-image=/export/home2/tmp/bak_pipe --backup-dir=/export/home2/tmp/meb-dir  --socket=/export/home2/tmp/mysql-5.1-meb-testing/mysql-test/var/tmp/mysqld.1.sock --user=root --port=13000 --protocol=tcp backup-to-image

Backup fails giving an error,
===========================================================================
Backup Image Path= /export/home2/tmp/bak_pipe
 mysqlbackup: ERROR: Backup image path exists. Use --force option to overwrite.
 mysqlbackup: ERROR: Initialization of backup image failed.
    Image Path = /export/home2/tmp/bak_pipe
 mysqlbackup: ERROR: Internal initialization for backup failed.
 mysqlbackup: INFO: Uses posix_fadvise() for performance optimization.
 mysqlbackup: INFO: System tablespace file format is Antelope.
 mysqlbackup: INFO: Found checkpoint at lsn 1694772368.
 mysqlbackup: INFO: Starting log scan from lsn 1694772224.
110208  5:22:18 mysqlbackup: INFO: Copying log...
110208  5:22:18 mysqlbackup: INFO: Log copied, lsn 1694772368.
          We wait 1 second before starting copying the data files...
110208  5:22:19 mysqlbackup: INFO: Copying /export/home2/tmp/mysql-5.1-meb-testing/mysql-test/var/mysqld.1/data/ibdata1 (Antelope file format).
 mysqlbackup: INFO: Adding File [Size:16777216]: ibdata1
mysqlbackup: Error writing file 'UNKNOWN' (Errcode: 9)
 mysqlbackup: ERROR: Problem encountered while adding file header to backup image.
  Component file path: ibdata1
 mysqlbackup: ERROR: Problem encountered while trying to add file to backup image.
  Component file path: ibdata1
 mysqlbackup: ERROR: Writing to data file /export/home2/tmp/meb-dir/ibdata1 failed!
=========================================================================

Suggested fix:
Backup to pipe should be possible
[10 Feb 2011 19:08] Valeriy Kravchuk
Verified on Mac OS X:

macbook-pro:meb-3.6 openxs$ mkfifo /tmp/bak_pipe
macbook-pro:meb-3.6 openxs$ chmod 660 /tmp/bak_pipe 
macbook-pro:meb-3.6 openxs$ bin/mysqlbackup -uroot --backup-image=/tmp/bak_pipe --backup-dir=/tmp/backup backup-to-image 

InnoDB Backup Utility v3.6.0 [2011/02/10] 
Copyright (c) 2003, 2011, Oracle and/or its affiliates. All Rights Reserved.

INFO: Starting with following command line ...
 bin/mysqlbackup -uroot --backup-image=/tmp/bak_pipe 
        --backup-dir=/tmp/backup backup-to-image 

INFO: Got some server configuration information from running server.

Created backup directory '/tmp/backup'
IMPORTANT: Please check that mysqlbackup run completes successfully.
            At the end of a successful 'backup-to-image' run mysqlbackup
            prints "mysqlbackup completed OK!".

--------------------------------------------------------------------
                       Server Repository Options:
--------------------------------------------------------------------
  datadir                          =  /Users/openxs/dbs/5.5/data/
  innodb_data_home_dir             =  
  innodb_data_file_path            =  ibdata1:10M:autoextend
  innodb_log_group_home_dir        =  /Users/openxs/dbs/5.5/data/
  innodb_log_files_in_group        =  2
  innodb_log_file_size             =  5242880

--------------------------------------------------------------------
                       Backup Config Options:
--------------------------------------------------------------------
  datadir                          =  /tmp/backup
  innodb_data_home_dir             =  /tmp/backup
  innodb_data_file_path            =  ibdata1:10M:autoextend
  innodb_log_group_home_dir        =  /tmp/backup
  innodb_log_files_in_group        =  2
  innodb_log_file_size             =  5242880

Backup Image Path= /tmp/bak_pipe
 mysqlbackup: ERROR: Backup image path exists. Use --force option to overwrite.
 mysqlbackup: ERROR: Initialization of backup image failed.
    Image Path = /tmp/bak_pipe
 mysqlbackup: ERROR: Internal initialization for backup failed.
 mysqlbackup: INFO: System tablespace file format is Antelope.
 mysqlbackup: INFO: Found checkpoint at lsn 1743176.
 mysqlbackup: INFO: Starting log scan from lsn 1742848.
110210 21:06:48 mysqlbackup: INFO: Copying log...
110210 21:06:48 mysqlbackup: INFO: Log copied, lsn 1743176.
          We wait 1 second before starting copying the data files...
110210 21:06:49 mysqlbackup: INFO: Copying /Users/openxs/dbs/5.5/data/ibdata1 (Antelope file format).
 mysqlbackup: INFO: Adding File [Size:16777216]: ibdata1
mysqlbackup: Error writing file 'UNKNOWN' (Errcode: 9)
 mysqlbackup: ERROR: Problem encountered while adding file header to backup image.
  Component file path: ibdata1
 mysqlbackup: ERROR: Problem encountered while trying to add file to backup image.
  Component file path: ibdata1
 mysqlbackup: ERROR: Writing to data file /tmp/backup/ibdata1 failed!
[16 Feb 2011 9:42] Thava Alagu
Please check if the latest patch of today solves the issue.
[28 Feb 2011 22:35] Hema Sridharan
This bug is still reproducible but with a different error
 mysqlbackup: INFO: Unique generated backup id for this is 12989324485597790
mysqlbackup: Can't create/write to file '/export/home2/tmp/meb-backups/bak_pipe/' (Errcode: 21)
 mysqlbackup: ERROR: Initialization of backup image failed.
    Image Path = /export/home2/tmp/meb-backups/bak_pipe/
 mysqlbackup: ERROR: Internal initialization for backup failed.
Error: operation failed.
[28 Feb 2011 22:46] Hema Sridharan
Note that error occurs only for the relative paths specified for backup-image and does not occur with absolute paths. The --backup-image=/export/home2/tmp/meb-backups/bak_pipe --backup-dir=/export/home2/tmp/meb-backups/bkpdir will error out but if you just give --backup-image=bak_pipe then it works just fine.