~sergei.glushchenko/percona-xtrabackup/BT-26901-2.0

« back to all changes in this revision

Viewing changes to test/t/ib_doublewrite.sh

  • Committer: Sergei Glushchenko
  • Date: 2012-11-15 15:27:58 UTC
  • Revision ID: sergei.glushchenko@percona.com-20121115152758-gnz0ufsulspdm23f
Bug #1066843: Fix for bug #932623 does not take separate doublewrite
tablespace into account
Bug #1068470: XtraBackup handles separate doublewrite buffer file incorrectly

Fixed by checking trx_sys_sys_space instead of space_id == 0.
innodb_doublewrite_file been added to backup-my.cnf.
Copy back now skip doublewrite tablespace.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
#               incorrectly
 
6
# We testing full and incremental backup and restore to check that
 
7
# separate doublewrite buffer file handled correctly
 
8
########################################################################
 
9
 
 
10
. inc/common.sh
 
11
 
 
12
if [ -z "$XTRADB_VERSION" ]; then
 
13
    echo "Requires XtraDB" > $SKIPPED_REASON
 
14
    exit $SKIPPED_EXIT_CODE
 
15
fi
 
16
 
 
17
DBLWR=dblwr.ibd
 
18
start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
 
19
load_dbase_schema incremental_sample
 
20
 
 
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 ()
 
24
{
 
25
        run_cmd $IB_BIN $IB_ARGS_NO_DEFAULTS_FILE $*
 
26
}
 
27
 
 
28
echo "innodb_doublewrite_file=${DBLWR}" >>$topdir/my.cnf
 
29
 
 
30
# Adding initial rows
 
31
vlog "Adding initial rows to database..."
 
32
${MYSQL} ${MYSQL_ARGS} -e "insert into test values (1, 1);" incremental_sample
 
33
 
 
34
# Full backup
 
35
# backup root directory
 
36
mkdir -p $topdir/backup
 
37
 
 
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
 
43
 
 
44
# Changing data
 
45
 
 
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
 
50
vlog "Changes done"
 
51
 
 
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"
 
57
 
 
58
vlog "Making incremental backup"
 
59
 
 
60
vlog "###############"
 
61
vlog "# INCREMENTAL #"
 
62
vlog "###############"
 
63
 
 
64
# Incremental backup
 
65
inc_backup_dir=$topdir/backup/inc
 
66
innobackupex --no-timestamp --incremental --incremental-basedir=$full_backup_dir \
 
67
    $inc_backup_dir
 
68
vlog "Incremental backup done to directory $inc_backup_dir"
 
69
 
 
70
vlog "Preparing backup"
 
71
# Prepare backup
 
72
vlog "##############"
 
73
vlog "# PREPARE #1 #"
 
74
vlog "##############"
 
75
innobackupex_no_defaults_file --apply-log --redo-only $full_backup_dir
 
76
vlog "Log applied to full backup"
 
77
vlog "##############"
 
78
vlog "# PREPARE #2 #"
 
79
vlog "##############"
 
80
innobackupex_no_defaults_file --apply-log --redo-only --incremental-dir=$inc_backup_dir \
 
81
    $full_backup_dir
 
82
vlog "Delta applied to full backup"
 
83
vlog "##############"
 
84
vlog "# PREPARE #3 #"
 
85
vlog "##############"
 
86
innobackupex_no_defaults_file --apply-log $full_backup_dir
 
87
vlog "Data prepared for restore"
 
88
 
 
89
# Destroying mysql data
 
90
stop_server
 
91
rm -rf $mysql_datadir/*
 
92
vlog "Data destroyed"
 
93
 
 
94
# Restore backup
 
95
vlog "Copying files"
 
96
vlog "###########"
 
97
vlog "# RESTORE #"
 
98
vlog "###########"
 
99
innobackupex --copy-back $full_backup_dir
 
100
vlog "Data restored"
 
101
 
 
102
start_server --innodb_file_per_table --innodb_doublewrite_file=${DBLWR}
 
103
 
 
104
vlog "Checking checksums"
 
105
checksum_test_b=`checksum_table incremental_sample test`
 
106
checksum_t2_b=`checksum_table incremental_sample t2`
 
107
 
 
108
if [ "$checksum_test_a" != "$checksum_test_b"  ]
 
109
then 
 
110
        vlog "Checksums for table 'test' are not equal"
 
111
        exit -1
 
112
fi
 
113
 
 
114
if [ "$checksum_t2_a" != "$checksum_t2_b"  ]
 
115
then 
 
116
        vlog "Checksums for table 't2' are not equal"
 
117
        exit -1
 
118
fi
 
119
 
 
120
vlog "Checksums are OK"