| 1 |
######## |
| 2 |
# Test for generating "innodb_corrupted_pages" file during full and |
| 3 |
# incremental backup, including DDL processing |
| 4 |
### |
| 5 |
|
| 6 |
CREATE TABLE t1_corrupted(c INT) ENGINE INNODB; |
| 7 |
CREATE TABLE t2_corrupted(c INT) ENGINE INNODB; |
| 8 |
CREATE TABLE t3(c INT) ENGINE INNODB; |
| 9 |
CREATE TABLE t5_corrupted_to_rename(c INT) ENGINE INNODB; |
| 10 |
CREATE TABLE t6_corrupted_to_drop(c INT) ENGINE INNODB; |
| 11 |
CREATE TABLE t7_corrupted_to_alter(c INT) ENGINE INNODB; |
| 12 |
CREATE TABLE t1_inc_corrupted(c INT) ENGINE INNODB; |
| 13 |
CREATE TABLE t2_inc_corrupted(c INT) ENGINE INNODB; |
| 14 |
CREATE TABLE t3_inc(c INT) ENGINE INNODB; |
| 15 |
CREATE TABLE t5_inc_corrupted_to_rename(c INT) ENGINE INNODB; |
| 16 |
CREATE TABLE t6_inc_corrupted_to_drop(c INT) ENGINE INNODB; |
| 17 |
CREATE TABLE t7_inc_corrupted_to_alter(c INT) ENGINE INNODB; |
| 18 |
INSERT INTO t1_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); |
| 19 |
INSERT INTO t2_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); |
| 20 |
INSERT INTO t3 VALUES (3), (4), (5), (6), (7), (8), (9); |
| 21 |
INSERT INTO t5_corrupted_to_rename VALUES (3), (4), (5), (6), (7), (8), (9); |
| 22 |
INSERT INTO t6_corrupted_to_drop VALUES (3), (4), (5), (6), (7), (8), (9); |
| 23 |
INSERT INTO t7_corrupted_to_alter VALUES (3), (4), (5), (6), (7), (8), (9); |
| 24 |
# Corrupt tables |
| 25 |
# restart |
| 26 |
# Backup must fail due to page corruption |
| 27 |
FOUND 1 /Database page corruption detected.*/ in backup.log |
| 28 |
# "innodb_corrupted_pages" file must not exist |
| 29 |
# 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 |
| 30 |
--- "innodb_corrupted_pages" file content: --- |
| 31 |
test/t1_corrupted |
| 32 |
4 6 7 |
| 33 |
test/t2_corrupted |
| 34 |
5 6 8 |
| 35 |
test/t5_corrupted_to_rename |
| 36 |
4 |
| 37 |
test/t6_corrupted_to_drop |
| 38 |
4 |
| 39 |
------ |
| 40 |
# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option |
| 41 |
FOUND 1 /Database page corruption detected.*/ in backup.log |
| 42 |
FOUND 1 /completed OK!/ in backup.log |
| 43 |
--- "innodb_corrupted_pages" file content: --- |
| 44 |
test/t1_corrupted |
| 45 |
4 6 7 |
| 46 |
test/t2_corrupted |
| 47 |
5 6 8 |
| 48 |
test/t4_corrupted_new |
| 49 |
1 |
| 50 |
test/t5_corrupted_to_rename_renamed |
| 51 |
4 |
| 52 |
test/t7_corrupted_to_alter |
| 53 |
3 |
| 54 |
------ |
| 55 |
INSERT INTO t1_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); |
| 56 |
INSERT INTO t2_inc_corrupted VALUES (3), (4), (5), (6), (7), (8), (9); |
| 57 |
INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9); |
| 58 |
# restart |
| 59 |
# 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 |
| 60 |
--- "innodb_corrupted_pages" file content: --- |
| 61 |
test/t1_corrupted |
| 62 |
4 6 7 |
| 63 |
test/t1_inc_corrupted |
| 64 |
4 6 7 |
| 65 |
test/t2_corrupted |
| 66 |
5 6 8 |
| 67 |
test/t2_inc_corrupted |
| 68 |
5 6 8 |
| 69 |
test/t5_corrupted_to_rename_renamed |
| 70 |
4 |
| 71 |
test/t5_inc_corrupted_to_rename |
| 72 |
4 |
| 73 |
test/t6_inc_corrupted_to_drop |
| 74 |
4 |
| 75 |
------ |
| 76 |
# Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option |
| 77 |
--- "innodb_corrupted_pages" file content: --- |
| 78 |
test/t1_corrupted |
| 79 |
4 6 7 |
| 80 |
test/t1_inc_corrupted |
| 81 |
4 6 7 |
| 82 |
test/t2_corrupted |
| 83 |
5 6 8 |
| 84 |
test/t2_inc_corrupted |
| 85 |
5 6 8 |
| 86 |
test/t4_inc_corrupted_new |
| 87 |
1 |
| 88 |
test/t5_corrupted_to_rename_renamed |
| 89 |
4 |
| 90 |
test/t5_inc_corrupted_to_rename_renamed |
| 91 |
4 |
| 92 |
test/t7_inc_corrupted_to_alter |
| 93 |
3 |
| 94 |
------ |
| 95 |
# Check if corrupted pages were copied to delta files, and non-corrupted pages are not copied. |
| 96 |
DROP TABLE t1_corrupted; |
| 97 |
DROP TABLE t2_corrupted; |
| 98 |
DROP TABLE t4_corrupted_new; |
| 99 |
DROP TABLE t5_corrupted_to_rename_renamed; |
| 100 |
DROP TABLE t7_corrupted_to_alter; |
| 101 |
DROP TABLE t1_inc_corrupted; |
| 102 |
DROP TABLE t2_inc_corrupted; |
| 103 |
DROP TABLE t4_inc_corrupted_new; |
| 104 |
DROP TABLE t5_inc_corrupted_to_rename_renamed; |
| 105 |
DROP TABLE t7_inc_corrupted_to_alter; |
| 106 |
|
| 107 |
######## |
| 108 |
# Test for --prepare with "innodb_corrupted_pages" file |
| 109 |
### |
| 110 |
|
| 111 |
# Extend some tablespace and corrupt extended pages for full backup |
| 112 |
# restart |
| 113 |
# Full backup with --log-innodb-page-corruption |
| 114 |
--- "innodb_corrupted_pages" file content: --- |
| 115 |
test/t3 |
| 116 |
4 6 |
| 117 |
------ |
| 118 |
# Extend some tablespace and corrupt extended pages for incremental backup |
| 119 |
# restart |
| 120 |
# Incremental backup --log-innodb-page-corruption |
| 121 |
--- "innodb_corrupted_pages" file content: --- |
| 122 |
test/t3 |
| 123 |
4 6 |
| 124 |
test/t3_inc |
| 125 |
4 6 |
| 126 |
------ |
| 127 |
# Full backup prepare |
| 128 |
# "innodb_corrupted_pages" file must not exist after successful prepare |
| 129 |
FOUND 1 /was successfully fixed.*/ in backup.log |
| 130 |
# Check that fixed pages are zero-filled |
| 131 |
# Incremental backup prepare |
| 132 |
# "innodb_corrupted_pages" file must not exist after successful prepare |
| 133 |
# do not remove "innodb_corrupted_pages" in incremental dir |
| 134 |
FOUND 1 /was successfully fixed.*/ in backup.log |
| 135 |
# Check that fixed pages are zero-filled |
| 136 |
# shutdown server |
| 137 |
# remove datadir |
| 138 |
# xtrabackup move back |
| 139 |
# restart |
| 140 |
SELECT * FROM t3; |
| 141 |
c |
| 142 |
3 |
| 143 |
4 |
| 144 |
5 |
| 145 |
6 |
| 146 |
7 |
| 147 |
8 |
| 148 |
9 |
| 149 |
SELECT * FROM t3_inc; |
| 150 |
c |
| 151 |
3 |
| 152 |
4 |
| 153 |
5 |
| 154 |
6 |
| 155 |
7 |
| 156 |
8 |
| 157 |
9 |
| 158 |
# Test the case when not all corrupted pages are fixed |
| 159 |
|
| 160 |
# Add some fake corrupted pages |
| 161 |
# Full backup prepare |
| 162 |
FOUND 1 /Error: corrupted page.*/ in backup.log |
| 163 |
--- "innodb_corrupted_pages" file content: --- |
| 164 |
test/t3 |
| 165 |
3 |
| 166 |
------ |
| 167 |
# Incremental backup prepare |
| 168 |
FOUND 1 /Error: corrupted page.*/ in backup.log |
| 169 |
--- "innodb_corrupted_pages" file content: --- |
| 170 |
test/t3 |
| 171 |
3 |
| 172 |
------ |
| 173 |
DROP TABLE t3; |
| 174 |
DROP TABLE t3_inc; |