| 1 |
******************************************************** |
| 2 |
ndb_restore threads exit cleanly on tuple restore error |
| 3 |
******************************************************** |
| 4 |
Initial tests using ndb_restore error insert to trigger |
| 5 |
error on all parts. |
| 6 |
create table t1(id int primary key, val int) engine=ndb; |
| 7 |
Cause backup stall |
| 8 |
Starting backup |
| 9 |
Backup started |
| 10 |
update t1 set val=12345 where id between 125 and 850; |
| 11 |
Waiting for backup to complete |
| 12 |
Backup completed |
| 13 |
Test restore failure handling for log-replay failure |
| 14 |
select count(*) into @msgcount from ndb_restore_output where a like "%Thread % failed, exiting" order by a; |
| 15 |
select @msgcount as 'Count of thread exit messages'; |
| 16 |
Count of thread exit messages |
| 17 |
4 |
| 18 |
select * from ndb_restore_output where @msgcount != 4; |
| 19 |
a |
| 20 |
truncate table t1; |
| 21 |
Test restore failure handling for tuple-restore failure |
| 22 |
select count(*) into @msgcount from ndb_restore_output where a like "%Thread % failed, exiting" order by a; |
| 23 |
select @msgcount as 'Count of thread exit messages'; |
| 24 |
Count of thread exit messages |
| 25 |
4 |
| 26 |
select * from ndb_restore_output where @msgcount != 4; |
| 27 |
a |
| 28 |
drop table t1; |
| 29 |
Test single part restore failures, should cause all parts to stop promptly |
| 30 |
Constraint violation on DATA restore |
| 31 |
create table test.t1 (a int primary key, b int, c int) engine=ndb; |
| 32 |
insert into test.t1 values (1000,1000,999); |
| 33 |
Starting backup |
| 34 |
Backup started |
| 35 |
Waiting for backup to complete |
| 36 |
Backup completed |
| 37 |
truncate test.t1; |
| 38 |
alter table test.t1 add unique(c); |
| 39 |
Test restore failure handling for data apply failure |
| 40 |
Expect 1 error type message |
| 41 |
select count(*) into @msgcount from ndb_restore_output where a like "%Permanent% duplicate value in unique index%"; |
| 42 |
select @msgcount as 'Count of error message 1'; |
| 43 |
Count of error message 1 |
| 44 |
1 |
| 45 |
select * from ndb_restore_output where @msgcount != 1; |
| 46 |
a |
| 47 |
Expect 1 error location message |
| 48 |
select count(*) into @msgcount from ndb_restore_output where a like "%Failed restoring DATA to table%"; |
| 49 |
select @msgcount as 'Count of error message 2'; |
| 50 |
Count of error message 2 |
| 51 |
1 |
| 52 |
select * from ndb_restore_output where @msgcount != 1; |
| 53 |
a |
| 54 |
Expect 1 error detail message |
| 55 |
select count(*) into @msgcount from ndb_restore_output where a like "%Failing tuple :%"; |
| 56 |
select @msgcount as 'Count of error message 3'; |
| 57 |
Count of error message 3 |
| 58 |
1 |
| 59 |
select * from ndb_restore_output where @msgcount != 1; |
| 60 |
a |
| 61 |
drop table test.t1; |
| 62 |
Constraint violation on LOG restore |
| 63 |
create table test.t1 (a int, b int, c int, primary key (a,b)) engine=ndb partition by key(a); |
| 64 |
Cause backup stall while log open |
| 65 |
Starting backup |
| 66 |
Backup started |
| 67 |
insert into t1 values(999,1000,999); |
| 68 |
Waiting for backup to complete |
| 69 |
Backup completed |
| 70 |
truncate test.t1; |
| 71 |
alter table test.t1 add unique(c); |
| 72 |
Test restore failure handling for log apply failure |
| 73 |
Expect 1 error type message |
| 74 |
select count(*) into @msgcount from ndb_restore_output where a like "%Permanent% duplicate value in unique index%"; |
| 75 |
select @msgcount as 'Count of error message 1'; |
| 76 |
Count of error message 1 |
| 77 |
1 |
| 78 |
select * from ndb_restore_output where @msgcount != 1; |
| 79 |
a |
| 80 |
Expect 1 error location message |
| 81 |
select count(*) into @msgcount from ndb_restore_output where a like "%Failed restoring LOG entry type INSERT to table%"; |
| 82 |
select @msgcount as 'Count of error message 2'; |
| 83 |
Count of error message 2 |
| 84 |
1 |
| 85 |
select * from ndb_restore_output where @msgcount != 1; |
| 86 |
a |
| 87 |
Expect 1 error detail message |
| 88 |
select count(*) into @msgcount from ndb_restore_output where a like "%Failing log entry :%"; |
| 89 |
select @msgcount as 'Count of error message 3'; |
| 90 |
Count of error message 3 |
| 91 |
1 |
| 92 |
select * from ndb_restore_output where @msgcount != 1; |
| 93 |
a |
| 94 |
drop table test.t1; |
| 95 |
Test that a temporary error applying |
| 96 |
log eventually results in failure |
| 97 |
create table test.t1 (a int primary key, b int) engine=ndb; |
| 98 |
Cause backup stall while log open |
| 99 |
Starting backup |
| 100 |
Backup started |
| 101 |
insert into t1 values(1,1); |
| 102 |
Waiting for backup to complete |
| 103 |
Backup completed |
| 104 |
Take a row lock to block restore |
| 105 |
begin; |
| 106 |
select * from test.t1 where a=1 for update; |
| 107 |
a b |
| 108 |
1 1 |
| 109 |
Test restore failure handling for log apply failure |
| 110 |
after retries |
| 111 |
Expect error message |
| 112 |
select count(*) into @msgcount from ndb_restore_output where a like "%Error restoring the data log%" or a like "%Error reading the data log%"; |
| 113 |
select @msgcount as 'Count of error message 1'; |
| 114 |
Count of error message 1 |
| 115 |
1 |
| 116 |
select * from ndb_restore_output where @msgcount != 1; |
| 117 |
a |
| 118 |
drop table test.t1; |
| 119 |
---------------- |
| 120 |
Test hint option |
| 121 |
---------------- |
| 122 |
Create backup with good amount of DATA + LOG content |
| 123 |
create table t1(id int primary key, val int) engine=ndb; |
| 124 |
Cause backup stall |
| 125 |
Starting backup |
| 126 |
Backup started |
| 127 |
update t1 set val=val+1; |
| 128 |
Waiting for backup to complete |
| 129 |
Backup completed |
| 130 |
Show transactions balanced across nodes by default |
| 131 |
(based on optimized node selection on localhost) |
| 132 |
Transaction balance of node 1 restore |
| 133 |
Expect balance ~ 50% : 50% (1 : 1) |
| 134 |
n1_trans |
| 135 |
1 |
| 136 |
n2_trans |
| 137 |
1 |
| 138 |
Transaction balance of node 2 restore |
| 139 |
Expect balance ~ 50% : 50% (1 : 1) |
| 140 |
n1_trans |
| 141 |
1 |
| 142 |
n2_trans |
| 143 |
1 |
| 144 |
Show that --hint causes each restore to use transactions |
| 145 |
hinted towards the specific node |
| 146 |
Transaction balance of node 1 hinted restore |
| 147 |
Expect balance ~ 100% : 0% (2 : 0) |
| 148 |
n1_trans |
| 149 |
2 |
| 150 |
n2_trans |
| 151 |
0 |
| 152 |
Transaction balance of node 2 hinted restore |
| 153 |
Expect balance ~ 0% : 100% (0 : 2) |
| 154 |
n1_trans |
| 155 |
0 |
| 156 |
n2_trans |
| 157 |
2 |
| 158 |
drop table t1; |
| 159 |
Test concurrent log apply outcomes |
| 160 |
create table t1 (a int primary key, b int) engine=ndb; |
| 161 |
create table t2 (a varchar(100) CHARSET utf8mb4 COLLATE utf8mb4_0900_ai_ci primary key, b int) engine=ndb; |
| 162 |
create table t3 (a int primary key, b int) engine=ndb; |
| 163 |
Insert rows |
| 164 |
Start backup with stall-while-logging |
| 165 |
Cause backup stall while log open |
| 166 |
Starting backup |
| 167 |
Backup started |
| 168 |
Modify rows so that backup log contains |
| 169 |
changes closely spaced |
| 170 |
This should maximise the chance of an out-of-order |
| 171 |
event apply leading to an incorrect final state |
| 172 |
Generate single long sequence of log ops on one key |
| 173 |
Complete backup |
| 174 |
Waiting for backup to complete |
| 175 |
Backup completed |
| 176 |
Expect all values in t1 to be 2 |
| 177 |
select count(1) from t1 where b = 2; |
| 178 |
count(1) |
| 179 |
100 |
| 180 |
select count(1) from t1 where b != 2; |
| 181 |
count(1) |
| 182 |
0 |
| 183 |
Expect all values in t2 to be 2 |
| 184 |
select count(1) from t2 where b = 2; |
| 185 |
count(1) |
| 186 |
100 |
| 187 |
select count(1) from t2 where b != 2; |
| 188 |
count(1) |
| 189 |
0 |
| 190 |
Expect all values in t3 to be 2999 |
| 191 |
select * from t3 order by a; |
| 192 |
a b |
| 193 |
1 2999 |
| 194 |
Now restore data and check content |
| 195 |
truncate t1; |
| 196 |
truncate t2; |
| 197 |
Expect all values in t1 to be 2 |
| 198 |
select count(1) from t1 where b = 2; |
| 199 |
count(1) |
| 200 |
100 |
| 201 |
select count(1) from t1 where b != 2; |
| 202 |
count(1) |
| 203 |
0 |
| 204 |
Expect all values in t2 to be 2 |
| 205 |
select count(1) from t2 where b = 2; |
| 206 |
count(1) |
| 207 |
100 |
| 208 |
select count(1) from t2 where b != 2; |
| 209 |
count(1) |
| 210 |
0 |
| 211 |
Expect all values in t3 to be 2999 |
| 212 |
select * from t3 order by a; |
| 213 |
a b |
| 214 |
1 2999 |
| 215 |
drop table t1; |
| 216 |
drop table t2; |
| 217 |
drop table t3; |
| 218 |
With a big log (>128K) check that ndb_restore will not fail close |
| 219 |
partially read log file when restoring epochs. |
| 220 |
create table t1 (pk int primary key, data varbinary(20000)) engine=ndb; |
| 221 |
Stall backup completion |
| 222 |
|
| 223 |
Run backup |
| 224 |
Starting backup |
| 225 |
Backup started |
| 226 |
Allow backup to complete... |
| 227 |
|
| 228 |
Waiting for backup to complete |
| 229 |
Backup completed |
| 230 |
drop table t1; |