1
########################################################################
2
# Bug #1066843: Fix for bug #932623 does not take separate doublewrite
3
# tablespace into account
4
# Bug #1068470: XtraBackup handles separate doublewrite buffer file
6
# We testing full and incremental backup and restore to check that
7
# separate doublewrite buffer file handled correctly
8
########################################################################
12
if [ -z "$XTRADB_VERSION" ]; then
13
echo "Requires XtraDB" > $SKIPPED_REASON
14
exit $SKIPPED_EXIT_CODE
18
start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
19
load_dbase_schema incremental_sample
21
# Workaround for bug #1072695
22
IB_ARGS_NO_DEFAULTS_FILE=`echo $IB_ARGS | sed -e 's/--defaults-file=[^ ]* / /'`
23
function innobackupex_no_defaults_file ()
25
run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
28
echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
31
vlog "Adding initial rows to database..."
32
${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
35
# backup root directory
36
mkdir -p $topdir/backup
38
vlog "Starting backup"
39
full_backup_dir=$topdir/backup/full
40
innobackupex --no-timestamp $full_backup_dir
41
vlog "Full backup done to directory $full_backup_dir"
42
cat $full_backup_dir/backup-my.cnf
46
vlog "Making changes to database"
47
${MYSQL} ${MYSQL_ARGS} -e "create table t2 (a int(11) default null, number int(11) default null) engine=innodb" incremental_sample
48
${MYSQL} ${MYSQL_ARGS} -e "insert into test values (10, 1);" incremental_sample
49
${MYSQL} ${MYSQL_ARGS} -e "insert into t2 values (10, 1);" incremental_sample
52
# Saving the checksum of original table
53
checksum_test_a=`checksum_table incremental_sample test`
54
checksum_t2_a=`checksum_table incremental_sample t2`
55
vlog "Table 'test' checksum is $checksum_test_a"
56
vlog "Table 't2' checksum is $checksum_t2_a"
58
vlog "Making incremental backup"
60
vlog "###############"
61
vlog "# INCREMENTAL #"
62
vlog "###############"
65
inc_backup_dir=$topdir/backup/inc
66
innobackupex --no-timestamp --incremental --incremental-basedir=$full_backup_dir \
68
vlog "Incremental backup done to directory $inc_backup_dir"
70
vlog "Preparing backup"
75
innobackupex_no_defaults_file --apply-log --redo-only $full_backup_dir
76
vlog "Log applied to full backup"
80
innobackupex_no_defaults_file --apply-log --redo-only --incremental-dir=$inc_backup_dir \
82
vlog "Delta applied to full backup"
86
innobackupex_no_defaults_file --apply-log $full_backup_dir
87
vlog "Data prepared for restore"
89
# Destroying mysql data
91
rm -rf $mysql_datadir/*
99
innobackupex --copy-back $full_backup_dir
102
start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
104
vlog "Checking checksums"
105
checksum_test_b=`checksum_table incremental_sample test`
106
checksum_t2_b=`checksum_table incremental_sample t2`
108
if [ "$checksum_test_a" != "$checksum_test_b" ]
110
vlog "Checksums for table 'test' are not equal"
114
if [ "$checksum_t2_a" != "$checksum_t2_b" ]
116
vlog "Checksums for table 't2' are not equal"
120
vlog "Checksums are OK"