A reduced test case. It seems that the bug happens when innodb-file-per-table is enabled and a table is created and inserted to between full and incremental backups.
. inc/common.sh
mysqld_additional_args="--innodb_file_per_table"
start_server ${mysqld_additional_args}
load_dbase_schema incremental_sample
# Full backup
# Full backup folder
rm -rf $topdir/data/full
mkdir -p $topdir/data/full
# Incremental data
rm -rf $topdir/data/delta
mkdir -p $topdir/data/delta
A reduced test case. It seems that the bug happens when innodb- file-per- table is enabled and a table is created and inserted to between full and incremental backups.
. inc/common.sh
mysqld_ additional_ args="- -innodb_ file_per_ table"
start_server ${mysqld_ additional_ args}
load_dbase_schema incremental_sample
# Full backup
# Full backup folder
rm -rf $topdir/data/full
mkdir -p $topdir/data/full
# Incremental data
rm -rf $topdir/data/delta
mkdir -p $topdir/data/delta
vlog "Starting backup"
xtrabackup --datadir= $mysql_ datadir --backup --target- dir=$topdir/ data/full \ additional_ args
$mysqld_
vlog "Full backup done"
# Changing data in sakila
vlog "Making changes to database"
${MYSQL} ${MYSQL_ARGS} -e "CREATE TABLE t2 (a INT(11) DEFAULT NULL, \
number INT(11) DEFAULT NULL) ENGINE=INNODB" incremental_sample
${MYSQL} ${MYSQL_ARGS} -e "INSERT INTO t2 VALUES (1, 1)" incremental_sample
vlog "Changes done"
# Saving the checksum of original table t2_a=`checksum_ table incremental_sample t2`
checksum_
vlog "Table 't2' checksum is $checksum_t2_a"
vlog "Making incremental backup"
# Incremental backup $mysql_ datadir --backup \ dir=$topdir/ data/delta --incremental- basedir= $topdir/ data/full \ additional_ args
xtrabackup --datadir=
--target-
$mysqld_
vlog "Incremental backup done"
vlog "Preparing backup"
# Prepare backup $mysql_ datadir --prepare --apply-log-only \ dir=$topdir/ data/full $mysqld_ additional_ args
xtrabackup --datadir=
--target-
vlog "Log applied to backup"
xtrabackup --datadir= $mysql_ datadir --prepare --apply-log-only \ dir=$topdir/ data/full --incremental- dir=$topdir/ data/delta \ additional_ args
--target-
$mysqld_
vlog "Delta applied to backup"
xtrabackup --datadir= $mysql_ datadir --prepare --target- dir=$topdir/ data/full \ additional_ args
$mysqld_
vlog "Data prepared for restore"
# removing rows
${MYSQL} ${MYSQL_ARGS} -e "delete from t2;" incremental_sample
vlog "Table cleared"
# Restore backup
stop_server
vlog "Copying files"
cd $topdir/data/full/
cp -r * $mysql_datadir
cd -
vlog "Data restored"
start_server ${mysqld_ additional_ args}
vlog "Checking checksums" t2_b=`checksum_ table incremental_sample t2`
checksum_
if [ "$checksum_t2_a" != "$checksum_t2_b" ]
then
vlog "Checksums of table 't2' are not equal"
exit -1
fi
vlog "Checksums are OK"
stop_server