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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
########
# Test for generating "innodb_corrupted_pages" file during full and
# incremental backup, including DDL processing
###
CREATE TABLE t1_corrupted(c INT) ENGINE INNODB;
CREATE TABLE t2_corrupted(c INT) ENGINE INNODB;
CREATE TABLE t3(c INT) ENGINE INNODB;
CREATE TABLE t5_corrupted_to_rename(c INT) ENGINE INNODB;
CREATE TABLE t6_corrupted_to_drop(c INT) ENGINE INNODB;
CREATE TABLE t7_corrupted_to_alter(c INT) ENGINE INNODB;
CREATE TABLE t1_inc_corrupted(c INT) ENGINE INNODB;
CREATE TABLE t2_inc_corrupted(c INT) ENGINE INNODB;
CREATE TABLE t3_inc(c INT) ENGINE INNODB;
CREATE TABLE t5_inc_corrupted_to_rename(c INT) ENGINE INNODB;
CREATE TABLE t6_inc_corrupted_to_drop(c INT) ENGINE INNODB;
CREATE TABLE t7_inc_corrupted_to_alter(c INT) ENGINE INNODB;
INSERT INTO t1_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t2_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t3 VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t5_corrupted_to_rename VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t6_corrupted_to_drop VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t7_corrupted_to_alter VALUES (3), (4), (5), (6), (7), (8), (9);
# Corrupt tables
# restart
# Backup must fail due to page corruption
FOUND 1 /Database page corruption detected.*/ in backup.log
# "innodb_corrupted_pages" file must not exist
# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option, and the file must contain all corrupted pages info, including those, which are supposed to be absent in the next test due to "DROP TABLE" execution during backup
--- "innodb_corrupted_pages" file content: ---
test/t1_corrupted
4 6 7
test/t2_corrupted
5 6 8
test/t5_corrupted_to_rename
4
test/t6_corrupted_to_drop
4
------
# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option
FOUND 1 /Database page corruption detected.*/ in backup.log
FOUND 1 /completed OK!/ in backup.log
--- "innodb_corrupted_pages" file content: ---
test/t1_corrupted
4 6 7
test/t2_corrupted
5 6 8
test/t4_corrupted_new
1
test/t5_corrupted_to_rename_renamed
4
test/t7_corrupted_to_alter
3
------
INSERT INTO t1_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t2_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9);
INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9);
# restart
# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option, and the file must contain all corrupted pages info, including those, which are supposed to be absent in the next test due to "DROP TABLE" execution during backup
--- "innodb_corrupted_pages" file content: ---
test/t1_corrupted
4 6 7
test/t1_inc_corrupted
4 6 7
test/t2_corrupted
5 6 8
test/t2_inc_corrupted
5 6 8
test/t5_corrupted_to_rename_renamed
4
test/t5_inc_corrupted_to_rename
4
test/t6_inc_corrupted_to_drop
4
------
# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option
--- "innodb_corrupted_pages" file content: ---
test/t1_corrupted
4 6 7
test/t1_inc_corrupted
4 6 7
test/t2_corrupted
5 6 8
test/t2_inc_corrupted
5 6 8
test/t4_inc_corrupted_new
1
test/t5_corrupted_to_rename_renamed
4
test/t5_inc_corrupted_to_rename_renamed
4
test/t7_inc_corrupted_to_alter
3
------
# Check if corrupted pages were copied to delta files, and non-corrupted pages are not copied.
DROP TABLE t1_corrupted;
DROP TABLE t2_corrupted;
DROP TABLE t4_corrupted_new;
DROP TABLE t5_corrupted_to_rename_renamed;
DROP TABLE t7_corrupted_to_alter;
DROP TABLE t1_inc_corrupted;
DROP TABLE t2_inc_corrupted;
DROP TABLE t4_inc_corrupted_new;
DROP TABLE t5_inc_corrupted_to_rename_renamed;
DROP TABLE t7_inc_corrupted_to_alter;
########
# Test for --prepare with "innodb_corrupted_pages" file
###
# Extend some tablespace and corrupt extended pages for full backup
# restart
# Full backup with --log-innodb-page-corruption
--- "innodb_corrupted_pages" file content: ---
test/t3
4 6
------
# Extend some tablespace and corrupt extended pages for incremental backup
# restart
# Incremental backup --log-innodb-page-corruption
--- "innodb_corrupted_pages" file content: ---
test/t3
4 6
test/t3_inc
4 6
------
# Full backup prepare
# "innodb_corrupted_pages" file must not exist after successful prepare
FOUND 1 /was successfully fixed.*/ in backup.log
# Check that fixed pages are zero-filled
# Incremental backup prepare
# "innodb_corrupted_pages" file must not exist after successful prepare
# do not remove "innodb_corrupted_pages" in incremental dir
FOUND 1 /was successfully fixed.*/ in backup.log
# Check that fixed pages are zero-filled
# shutdown server
# remove datadir
# xtrabackup move back
# restart
SELECT * FROM t3;
c
3
4
5
6
7
8
9
SELECT * FROM t3_inc;
c
3
4
5
6
7
8
9
# Test the case when not all corrupted pages are fixed
# Add some fake corrupted pages
# Full backup prepare
FOUND 1 /Error: corrupted page.*/ in backup.log
--- "innodb_corrupted_pages" file content: ---
test/t3
3
------
# Incremental backup prepare
FOUND 1 /Error: corrupted page.*/ in backup.log
--- "innodb_corrupted_pages" file content: ---
test/t3
3
------
DROP TABLE t3;
DROP TABLE t3_inc;
|