| 1 |
Check behaviour when restoring with remap |
| 2 |
and log content. |
| 3 |
Backup type 2 |
| 4 |
create table t1 (a int auto_increment primary key, b int, c text) engine=ndb; |
| 5 |
insert into t1 (b,c) values |
| 6 |
(1, repeat('B', 2000)), |
| 7 |
(2, repeat('J', 3000)), |
| 8 |
(3, repeat('C', 3500)), |
| 9 |
(4, repeat('T', 3300)), |
| 10 |
(5, repeat('S', 1234)), |
| 11 |
(6, repeat('G', 3333)); |
| 12 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 13 |
a b length(c) sha1(c) |
| 14 |
1 1 2000 6d41e1d402596dff36396d1f0f288d17a4b9800a |
| 15 |
2 2 3000 7ba41510385abe2274d01caa4a078103f5d9c919 |
| 16 |
3 3 3500 70471521682517c36d93229ed39b549b7c8ce920 |
| 17 |
4 4 3300 bccbd2cd904585b0e9f4a8d2cc357005e50e7bf7 |
| 18 |
5 5 1234 0651c1d347cfdb9fa28d35b6522bf99063e144f3 |
| 19 |
6 6 3333 187698f203586e5b36663ef3b2361ae7c89b358f |
| 20 |
Cause backup stall |
| 21 |
Starting backup |
| 22 |
Backup started |
| 23 |
insert into t1 (b,c) values |
| 24 |
(7, repeat('D', 999)); |
| 25 |
insert into t1 (a,b,c) values (1000, 1000, repeat('MU', 444)); |
| 26 |
delete from t1 where b=4; |
| 27 |
update t1 set a=1010 where a=2; |
| 28 |
begin; |
| 29 |
insert into t1 (a,b,c) values (500, 500, repeat('AR', 1000)); |
| 30 |
update t1 set c=repeat('AG', 3000) where a=500; |
| 31 |
insert into t1 (a,b,c) values (501, 501, repeat('AR', 1000)); |
| 32 |
update t1 set b=5010 where a=501; |
| 33 |
commit; |
| 34 |
begin; |
| 35 |
insert into t1 (a,b,c) values (502, 502, repeat('AR', 1500)); |
| 36 |
update t1 set c=repeat('AG', 2000) where a=502; |
| 37 |
delete from t1 where a=502; |
| 38 |
insert into t1 (a,b,c) values (503, 503, repeat('AR', 1500)); |
| 39 |
update t1 set b=5030 where a=503; |
| 40 |
delete from t1 where a=503; |
| 41 |
commit; |
| 42 |
begin; |
| 43 |
insert into t1 (a,b,c) values (504, 504, repeat('AR', 2000)); |
| 44 |
update t1 set c=repeat('AG', 2500) where a=504; |
| 45 |
delete from t1 where a=504; |
| 46 |
insert into t1 (a,b,c) values (504, 5040, repeat('ON', 2500)); |
| 47 |
insert into t1 (a,b,c) values (505, 505, repeat('AR', 2000)); |
| 48 |
update t1 set b=5050 where a=505; |
| 49 |
delete from t1 where a=505; |
| 50 |
insert into t1 (a,b,c) values (505, 50500, repeat('ON', 2000)); |
| 51 |
commit; |
| 52 |
insert into t1 (a,b,c) values (510, 510, repeat('ON', 1500)); |
| 53 |
insert into t1 (a,b,c) values (511, 511, repeat('AG', 2000)); |
| 54 |
insert into t1 (a,b,c) values (512, 512, repeat('AR', 2500)); |
| 55 |
insert into t1 (a,b,c) values (513, 513, repeat('TR', 2500)); |
| 56 |
insert into t1 (a,b,c) values (514, 514, repeat('IZ', 2500)); |
| 57 |
insert into t1 (a,b,c) values (515, 515, repeat('EA', 2500)); |
| 58 |
begin; |
| 59 |
update t1 set c=repeat('AG', 2700) where a=510; |
| 60 |
delete from t1 where a=510; |
| 61 |
update t1 set b=5110 where a=511; |
| 62 |
delete from t1 where a=511; |
| 63 |
commit; |
| 64 |
begin; |
| 65 |
update t1 set c=repeat('TR', 1300) where a=512; |
| 66 |
delete from t1 where a=512; |
| 67 |
insert into t1 (a,b,c) values (512, 5120, repeat('IZ', 2499)); |
| 68 |
update t1 set b=5130 where a=513; |
| 69 |
delete from t1 where a=513; |
| 70 |
insert into t1 (a,b,c) values (513, 51300, repeat('ON', 1788)); |
| 71 |
commit; |
| 72 |
begin; |
| 73 |
update t1 set c=repeat('ON', 1234) where a=514; |
| 74 |
delete from t1 where a=514; |
| 75 |
insert into t1 (a,b,c) values (514, 5140, repeat('EA', 1111)); |
| 76 |
update t1 set c=repeat('AG', 3000) where a=514; |
| 77 |
update t1 set b=5150 where a=515; |
| 78 |
delete from t1 where a=515; |
| 79 |
insert into t1 (a,b,c) values (515, 51500, repeat('TR', 2222)); |
| 80 |
update t1 set b=515000 where a=515; |
| 81 |
commit; |
| 82 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 83 |
a b length(c) sha1(c) |
| 84 |
1 1 2000 6d41e1d402596dff36396d1f0f288d17a4b9800a |
| 85 |
3 3 3500 70471521682517c36d93229ed39b549b7c8ce920 |
| 86 |
5 5 1234 0651c1d347cfdb9fa28d35b6522bf99063e144f3 |
| 87 |
6 6 3333 187698f203586e5b36663ef3b2361ae7c89b358f |
| 88 |
7 7 999 46fc7a0af9239159e300028f6c6ebb7a2a88c409 |
| 89 |
500 500 6000 a84096e6f4cfd316b4399fb030b4eb3d01de46e3 |
| 90 |
501 5010 2000 192337269ed710279d4f3373cf8f597230708f3a |
| 91 |
504 5040 5000 c80ac9df1867ca5866f87d1275519f8873966e8f |
| 92 |
505 50500 4000 4b5ca3dd0e6e6cbad39fbf76a02e634011d5c16a |
| 93 |
512 5120 4998 4ec4496f22cc8e5863fc006e35ec6f2aa27b4659 |
| 94 |
513 51300 3576 51a211bff79d8f0ab426c333ba70241d5ec32889 |
| 95 |
514 5140 6000 a84096e6f4cfd316b4399fb030b4eb3d01de46e3 |
| 96 |
515 515000 4444 b1d8dc80a0475de078a57628b29d5547e373975a |
| 97 |
1000 1000 888 96f2125198fb7a058d0e2efb86dffda145f39a56 |
| 98 |
1010 2 3000 7ba41510385abe2274d01caa4a078103f5d9c919 |
| 99 |
show create table t1; |
| 100 |
Table Create Table |
| 101 |
t1 CREATE TABLE `t1` ( |
| 102 |
`a` int NOT NULL AUTO_INCREMENT, |
| 103 |
`b` int DEFAULT NULL, |
| 104 |
`c` text, |
| 105 |
PRIMARY KEY (`a`) |
| 106 |
) ENGINE=ndbcluster AUTO_INCREMENT=1011 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 107 |
Waiting for backup to complete |
| 108 |
Backup completed |
| 109 |
drop table test.t1; |
| 110 |
Restore data |
| 111 |
create table t1 (a int auto_increment primary key, b int, c text) engine=ndb; |
| 112 |
Node 1 |
| 113 |
Node 2 |
| 114 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 115 |
a b length(c) sha1(c) |
| 116 |
4001 1 2000 6d41e1d402596dff36396d1f0f288d17a4b9800a |
| 117 |
4003 3 3500 70471521682517c36d93229ed39b549b7c8ce920 |
| 118 |
4005 5 1234 0651c1d347cfdb9fa28d35b6522bf99063e144f3 |
| 119 |
4006 6 3333 187698f203586e5b36663ef3b2361ae7c89b358f |
| 120 |
4007 7 999 46fc7a0af9239159e300028f6c6ebb7a2a88c409 |
| 121 |
4500 500 6000 a84096e6f4cfd316b4399fb030b4eb3d01de46e3 |
| 122 |
4501 5010 2000 192337269ed710279d4f3373cf8f597230708f3a |
| 123 |
4504 5040 5000 c80ac9df1867ca5866f87d1275519f8873966e8f |
| 124 |
4505 50500 4000 4b5ca3dd0e6e6cbad39fbf76a02e634011d5c16a |
| 125 |
4512 5120 4998 4ec4496f22cc8e5863fc006e35ec6f2aa27b4659 |
| 126 |
4513 51300 3576 51a211bff79d8f0ab426c333ba70241d5ec32889 |
| 127 |
4514 5140 6000 a84096e6f4cfd316b4399fb030b4eb3d01de46e3 |
| 128 |
4515 515000 4444 b1d8dc80a0475de078a57628b29d5547e373975a |
| 129 |
5000 1000 888 96f2125198fb7a058d0e2efb86dffda145f39a56 |
| 130 |
5010 2 3000 7ba41510385abe2274d01caa4a078103f5d9c919 |
| 131 |
Check restored auto-inc metadata : |
| 132 |
Expect that auto-increment next is 5011, e.g. > highest remapped row that |
| 133 |
existed at end of backup time |
| 134 |
(note that SNAPSHOTSTART does not snapshot autoinc metadata) |
| 135 |
|
| 136 |
show create table t1; |
| 137 |
Table Create Table |
| 138 |
t1 CREATE TABLE `t1` ( |
| 139 |
`a` int NOT NULL AUTO_INCREMENT, |
| 140 |
`b` int DEFAULT NULL, |
| 141 |
`c` text, |
| 142 |
PRIMARY KEY (`a`) |
| 143 |
) ENGINE=ndbcluster AUTO_INCREMENT=5011 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 144 |
drop table test.t1; |
| 145 |
Backup type 1 |
| 146 |
create table t1 (a int auto_increment primary key, b int, c text) engine=ndb; |
| 147 |
insert into t1 (b,c) values |
| 148 |
(1, repeat('B', 2000)), |
| 149 |
(2, repeat('J', 3000)), |
| 150 |
(3, repeat('C', 3500)), |
| 151 |
(4, repeat('T', 3300)), |
| 152 |
(5, repeat('S', 1234)), |
| 153 |
(6, repeat('G', 3333)); |
| 154 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 155 |
a b length(c) sha1(c) |
| 156 |
1 1 2000 6d41e1d402596dff36396d1f0f288d17a4b9800a |
| 157 |
2 2 3000 7ba41510385abe2274d01caa4a078103f5d9c919 |
| 158 |
3 3 3500 70471521682517c36d93229ed39b549b7c8ce920 |
| 159 |
4 4 3300 bccbd2cd904585b0e9f4a8d2cc357005e50e7bf7 |
| 160 |
5 5 1234 0651c1d347cfdb9fa28d35b6522bf99063e144f3 |
| 161 |
6 6 3333 187698f203586e5b36663ef3b2361ae7c89b358f |
| 162 |
Cause backup stall |
| 163 |
Starting SNAPSHOTSTART backup |
| 164 |
Backup started |
| 165 |
insert into t1 (b,c) values |
| 166 |
(7, repeat('D', 999)); |
| 167 |
insert into t1 (a,b,c) values (1000, 1000, repeat('MU', 444)); |
| 168 |
delete from t1 where b=4; |
| 169 |
update t1 set a=1010 where a=2; |
| 170 |
begin; |
| 171 |
insert into t1 (a,b,c) values (500, 500, repeat('AR', 1000)); |
| 172 |
update t1 set c=repeat('AG', 3000) where a=500; |
| 173 |
insert into t1 (a,b,c) values (501, 501, repeat('AR', 1000)); |
| 174 |
update t1 set b=5010 where a=501; |
| 175 |
commit; |
| 176 |
begin; |
| 177 |
insert into t1 (a,b,c) values (502, 502, repeat('AR', 1500)); |
| 178 |
update t1 set c=repeat('AG', 2000) where a=502; |
| 179 |
delete from t1 where a=502; |
| 180 |
insert into t1 (a,b,c) values (503, 503, repeat('AR', 1500)); |
| 181 |
update t1 set b=5030 where a=503; |
| 182 |
delete from t1 where a=503; |
| 183 |
commit; |
| 184 |
begin; |
| 185 |
insert into t1 (a,b,c) values (504, 504, repeat('AR', 2000)); |
| 186 |
update t1 set c=repeat('AG', 2500) where a=504; |
| 187 |
delete from t1 where a=504; |
| 188 |
insert into t1 (a,b,c) values (504, 5040, repeat('ON', 2500)); |
| 189 |
insert into t1 (a,b,c) values (505, 505, repeat('AR', 2000)); |
| 190 |
update t1 set b=5050 where a=505; |
| 191 |
delete from t1 where a=505; |
| 192 |
insert into t1 (a,b,c) values (505, 50500, repeat('ON', 2000)); |
| 193 |
commit; |
| 194 |
insert into t1 (a,b,c) values (510, 510, repeat('ON', 1500)); |
| 195 |
insert into t1 (a,b,c) values (511, 511, repeat('AG', 2000)); |
| 196 |
insert into t1 (a,b,c) values (512, 512, repeat('AR', 2500)); |
| 197 |
insert into t1 (a,b,c) values (513, 513, repeat('TR', 2500)); |
| 198 |
insert into t1 (a,b,c) values (514, 514, repeat('IZ', 2500)); |
| 199 |
insert into t1 (a,b,c) values (515, 515, repeat('EA', 2500)); |
| 200 |
begin; |
| 201 |
update t1 set c=repeat('AG', 2700) where a=510; |
| 202 |
delete from t1 where a=510; |
| 203 |
update t1 set b=5110 where a=511; |
| 204 |
delete from t1 where a=511; |
| 205 |
commit; |
| 206 |
begin; |
| 207 |
update t1 set c=repeat('TR', 1300) where a=512; |
| 208 |
delete from t1 where a=512; |
| 209 |
insert into t1 (a,b,c) values (512, 5120, repeat('IZ', 2499)); |
| 210 |
update t1 set b=5130 where a=513; |
| 211 |
delete from t1 where a=513; |
| 212 |
insert into t1 (a,b,c) values (513, 51300, repeat('ON', 1788)); |
| 213 |
commit; |
| 214 |
begin; |
| 215 |
update t1 set c=repeat('ON', 1234) where a=514; |
| 216 |
delete from t1 where a=514; |
| 217 |
insert into t1 (a,b,c) values (514, 5140, repeat('EA', 1111)); |
| 218 |
update t1 set c=repeat('AG', 3000) where a=514; |
| 219 |
update t1 set b=5150 where a=515; |
| 220 |
delete from t1 where a=515; |
| 221 |
insert into t1 (a,b,c) values (515, 51500, repeat('TR', 2222)); |
| 222 |
update t1 set b=515000 where a=515; |
| 223 |
commit; |
| 224 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 225 |
a b length(c) sha1(c) |
| 226 |
1 1 2000 6d41e1d402596dff36396d1f0f288d17a4b9800a |
| 227 |
3 3 3500 70471521682517c36d93229ed39b549b7c8ce920 |
| 228 |
5 5 1234 0651c1d347cfdb9fa28d35b6522bf99063e144f3 |
| 229 |
6 6 3333 187698f203586e5b36663ef3b2361ae7c89b358f |
| 230 |
7 7 999 46fc7a0af9239159e300028f6c6ebb7a2a88c409 |
| 231 |
500 500 6000 a84096e6f4cfd316b4399fb030b4eb3d01de46e3 |
| 232 |
501 5010 2000 192337269ed710279d4f3373cf8f597230708f3a |
| 233 |
504 5040 5000 c80ac9df1867ca5866f87d1275519f8873966e8f |
| 234 |
505 50500 4000 4b5ca3dd0e6e6cbad39fbf76a02e634011d5c16a |
| 235 |
512 5120 4998 4ec4496f22cc8e5863fc006e35ec6f2aa27b4659 |
| 236 |
513 51300 3576 51a211bff79d8f0ab426c333ba70241d5ec32889 |
| 237 |
514 5140 6000 a84096e6f4cfd316b4399fb030b4eb3d01de46e3 |
| 238 |
515 515000 4444 b1d8dc80a0475de078a57628b29d5547e373975a |
| 239 |
1000 1000 888 96f2125198fb7a058d0e2efb86dffda145f39a56 |
| 240 |
1010 2 3000 7ba41510385abe2274d01caa4a078103f5d9c919 |
| 241 |
show create table t1; |
| 242 |
Table Create Table |
| 243 |
t1 CREATE TABLE `t1` ( |
| 244 |
`a` int NOT NULL AUTO_INCREMENT, |
| 245 |
`b` int DEFAULT NULL, |
| 246 |
`c` text, |
| 247 |
PRIMARY KEY (`a`) |
| 248 |
) ENGINE=ndbcluster AUTO_INCREMENT=1011 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 249 |
Waiting for backup to complete |
| 250 |
Backup completed |
| 251 |
drop table test.t1; |
| 252 |
Restore data |
| 253 |
create table t1 (a int auto_increment primary key, b int, c text) engine=ndb; |
| 254 |
Node 1 |
| 255 |
Node 2 |
| 256 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 257 |
a b length(c) sha1(c) |
| 258 |
4001 1 2000 6d41e1d402596dff36396d1f0f288d17a4b9800a |
| 259 |
4002 2 3000 7ba41510385abe2274d01caa4a078103f5d9c919 |
| 260 |
4003 3 3500 70471521682517c36d93229ed39b549b7c8ce920 |
| 261 |
4004 4 3300 bccbd2cd904585b0e9f4a8d2cc357005e50e7bf7 |
| 262 |
4005 5 1234 0651c1d347cfdb9fa28d35b6522bf99063e144f3 |
| 263 |
4006 6 3333 187698f203586e5b36663ef3b2361ae7c89b358f |
| 264 |
Check restored auto-inc metadata : |
| 265 |
Expect that auto-increment next is 5011, e.g. > highest remapped row that |
| 266 |
existed at end of backup time |
| 267 |
(note that SNAPSHOTSTART does not snapshot autoinc metadata) |
| 268 |
|
| 269 |
show create table t1; |
| 270 |
Table Create Table |
| 271 |
t1 CREATE TABLE `t1` ( |
| 272 |
`a` int NOT NULL AUTO_INCREMENT, |
| 273 |
`b` int DEFAULT NULL, |
| 274 |
`c` text, |
| 275 |
PRIMARY KEY (`a`) |
| 276 |
) ENGINE=ndbcluster AUTO_INCREMENT=5011 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 277 |
drop table test.t1; |