5.1 Example: Applying the Log to a Backup

This example continues from Section 4.1, “Example: Making an Uncompressed Backup of InnoDB Tables”.

The backup directory looks like this before applying the log to the backup:

$ ls -l /sqldata-backup
total 499728
-rw-r--r-- 1 pekka pekka       158 2010-12-08 15:33 ibbackup_export_variables.txt
-rw-r----- 1 pekka pekka      1024 2010-12-08 15:33 ibbackup_logfile
-rw-r----- 1 pekka pekka  10485760 2010-12-08 15:32 ibdata1
-rw-r----- 1 pekka pekka  20971520 2010-12-08 15:32 ibdata2
-rw-r----- 1 pekka pekka 480247808 2010-12-08 15:33 ibdata3

We run ibbackup to roll forward the data files so that they correspond to the same log sequence number:

$ ibbackup --apply-log /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

101208 15:47:17  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 15:47:18  ibbackup: Full backup prepared for recovery successfully!

The contents of the backup directory after applying the log. ibbackup created InnoDB log files (ib_logfile*) and applied log records to the InnoDB data files (ibdata*):

$ ls -l /sqldata-backup
total 530448
-rw-r--r-- 1 pekka pekka       158 2010-12-08 15:33 ibbackup_export_variables.txt
-rw-r----- 1 pekka pekka      1024 2010-12-08 15:33 ibbackup_logfile
-rw-r----- 1 pekka pekka  10485760 2010-12-08 15:32 ibdata1
-rw-r----- 1 pekka pekka  20971520 2010-12-08 15:32 ibdata2
-rw-r----- 1 pekka pekka 480247808 2010-12-08 15:33 ibdata3
-rw-r----- 1 pekka pekka  10485760 2010-12-08 15:47 ib_logfile0
-rw-r----- 1 pekka pekka  10485760 2010-12-08 15:47 ib_logfile1
-rw-r----- 1 pekka pekka  10485760 2010-12-08 15:47 ib_logfile2