~akopytov/percona-xtrabackup/bugs-1177206-and-1187071-2.1

« back to all changes in this revision

Viewing changes to test/t/ddl.sh

  • Committer: Alexey Kopytov
  • Date: 2013-05-16 18:03:01 UTC
  • mfrom: (595.1.1 2.1)
  • Revision ID: akopytov@gmail.com-20130516180301-c23mooyxyglif3wh
MergedĀ lp:~akopytov/percona-xtrabackup/bug1079700-2.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
########################################################################
2
 
# Bug #722638: xtrabackup: taking backup while tables are droped and 
 
1
############################################################################
 
2
# Bug #722638: xtrabackup: taking backup while tables are droped and
3
3
#              created breaks backup
4
 
########################################################################
 
4
#
 
5
# Bug #1079700: Issues with renaming/rotating tables during the backup stage
 
6
############################################################################
5
7
 
6
8
. inc/common.sh
7
9
 
10
12
    exit $SKIPPED_EXIT_CODE
11
13
fi
12
14
 
13
 
start_server --innodb_file_per_table
 
15
MYSQLD_EXTRA_MY_CNF_OPTS="
 
16
innodb_file_per_table
 
17
"
 
18
 
 
19
start_server
14
20
 
15
21
run_cmd $MYSQL $MYSQL_ARGS test <<EOF
16
22
 
26
32
CREATE TABLE t4_old(a INT) ENGINE=InnoDB;
27
33
INSERT INTO t4_old VALUES (1), (2), (3);
28
34
 
 
35
CREATE TABLE t5(a INT) ENGINE=InnoDB;
 
36
INSERT INTO t5 VALUES (1), (2), (3);
 
37
 
 
38
CREATE TABLE t6(c CHAR(1)) ENGINE=InnoDB;
 
39
INSERT INTO t6 VALUES ('a'), ('b'), ('c');
 
40
 
29
41
EOF
30
42
 
 
43
# Make a checkpoint so that original tablespace creation events are not in the
 
44
# xtrabackup log
 
45
shutdown_server
 
46
start_server
 
47
 
31
48
mkdir -p $topdir/backup
32
49
 
33
50
# Backup
70
87
ALTER TABLE t4_old RENAME t4;
71
88
INSERT INTO t4 VALUES (7), (8), (9);
72
89
 
 
90
INSERT INTO t5 VALUES (4), (5), (6);
 
91
INSERT INTO t6 VALUES ('d'), ('e'), ('f');
 
92
 
 
93
# Rotate tables t5 and t6
 
94
RENAME TABLE t5 TO temp, t6 TO t5, temp TO t6;
 
95
 
 
96
INSERT INTO t5 VALUES ('g'), ('h'), ('i');
 
97
INSERT INTO t6 VALUES (7), (8), (9);
 
98
 
73
99
EOF
74
100
 
75
 
# Calculate checksums
76
 
checksum_t1=`checksum_table test t1`
77
 
checksum_t2=`checksum_table test t2`
78
 
checksum_t3=`checksum_table test t3`
79
 
checksum_t4=`checksum_table test t4`
 
101
record_db_state test
80
102
 
81
103
# Resume xtrabackup
82
104
vlog "Resuming xtrabackup"
84
106
 
85
107
run_cmd wait $job_pid
86
108
 
 
109
# exit 1
 
110
 
87
111
# Prepare
88
112
xtrabackup --datadir=$mysql_datadir --prepare --target-dir=$topdir/backup
89
113
 
94
118
    $mysql_datadir/test/*.ibd
95
119
cp -r $topdir/backup/* $mysql_datadir
96
120
 
97
 
start_server --innodb_file_per_table
98
 
 
99
 
# Verify checksums
100
 
checksum_t1_new=`checksum_table test t1`
101
 
checksum_t2_new=`checksum_table test t2`
102
 
checksum_t3_new=`checksum_table test t3`
103
 
checksum_t4_new=`checksum_table test t4`
104
 
vlog "Checksums (old/new):"
105
 
vlog "t1: $checksum_t1/$checksum_t1_new"
106
 
vlog "t2: $checksum_t2/$checksum_t2_new"
107
 
vlog "t3: $checksum_t3/$checksum_t3_new"
108
 
vlog "t4: $checksum_t4/$checksum_t4_new"
109
 
 
110
 
if [ "$checksum_t1" = "$checksum_t1_new" -a \
111
 
     "$checksum_t2" = "$checksum_t2_new" -a \
112
 
     "$checksum_t3" = "$checksum_t3_new" -a \
113
 
     "$checksum_t4" = "$checksum_t4_new" ]; then
114
 
    exit 0
115
 
fi
116
 
 
117
 
vlog "Checksums do not match"
118
 
exit -1
 
121
start_server
 
122
 
 
123
# Verify backup
 
124
verify_db_state test