5.2 Example: Applying the Log to a Compressed Backup

This example continues from Section 4.2, “Example: Making a Compressed Backup of InnoDB Tables”.

If the backup is compressed, specify the --uncompress option to ibbackup when applying the log to the backup:

$ ibbackup --apply-log --uncompress /home/pekka/.backup-my.cnf
ibbackup version 3.5.2 MySQL Enterprise Backup 3.5.2
Copyright (c) 2002, 2010, Oracle and/or its affiliates.
Run 'ibbackup --help' for help and 'ibbackup --version' for version info.

Note: Uses posix_fadvise() for performance optimization.

Contents of /home/pekka/.backup-my.cnf:
innodb_data_home_dir got value /sqldata-backup
innodb_data_file_path got value ibdata1:10M;ibdata2:20M;ibdata3:50M:autoextend
datadir got value /sqldata-backup
innodb_log_group_home_dir got value /sqldata-backup
innodb_log_files_in_group got value 3
innodb_log_file_size got value 10485760

ibbackup: Uncompressing data file '/sqldata-backup/ibdata1.ibz'
ibbackup: Uncompressing data file '/sqldata-backup/ibdata2.ibz'
ibbackup: Uncompressing data file '/sqldata-backup/ibdata3.ibz'
 400
101208 16:06:16  ibbackup: ibbackup_logfile's creation parameters:
ibbackup: start lsn 32164666880, end lsn 32164666892,
ibbackup: start checkpoint 32164666892.
InnoDB: Doing recovery: scanned up to log sequence number 32164666892
InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 Setting log file size to 0 10485760
Setting log file size to 0 10485760
Setting log file size to 0 10485760
ibbackup: We were able to parse ibbackup_logfile up to
ibbackup: lsn 32164666892.
ibbackup: Last MySQL binlog file position 0 534, file name ./MySQL-bin.000008
ibbackup: The first data file is '/sqldata-backup/ibdata1'
ibbackup: and the new created log files are at '/sqldata-backup/'
ibbackup: System tablespace file format is Antelope.
101208 16:06:21  ibbackup: Full backup prepared for recovery successfully!

The contents of the backup directory after successfully applying the log to the backup are shown below. The ibbackup output above shows that data files were rolled forward to log sequence number (lsn) 32164666892. Since ibbackup does not modify any of the original files in the backup (compressed data files and ibbackup log file), nothing is lost if the apply-log operation fails for some reason (for example, insufficient disk space). After fixing the problem, you can safely try the apply-log operation again.

$ ls -l /sqldata-backup
total 585120
-rw-r--r-- 1 pekka pekka       158 2010-12-08 15:48 ibbackup_export_variables.txt
-rw-r----- 1 pekka pekka      1024 2010-12-08 15:48 ibbackup_logfile
-rw-r----- 1 pekka pekka  10485760 2010-12-08 16:05 ibdata1
-rw-r----- 1 pekka pekka   1095854 2010-12-08 15:47 ibdata1.ibz
-rw-r----- 1 pekka pekka  20971520 2010-12-08 16:05 ibdata2
-rw-r----- 1 pekka pekka    811625 2010-12-08 15:47 ibdata2.ibz
-rw-r----- 1 pekka pekka 480247808 2010-12-08 16:06 ibdata3
-rw-r----- 1 pekka pekka  54058462 2010-12-08 15:48 ibdata3.ibz
-rw-r----- 1 pekka pekka  10485760 2010-12-08 16:06 ib_logfile0
-rw-r----- 1 pekka pekka  10485760 2010-12-08 16:06 ib_logfile1
-rw-r----- 1 pekka pekka  10485760 2010-12-08 16:06 ib_logfile2