| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source suite/ndb/include/backup_restore_setup.inc |
| 3 |
|
| 4 |
--echo # bug#17275798 |
| 5 |
# use a canned backup with NULL char(10) log entries promoted to char(20) |
| 6 |
|
| 7 |
create table t1 ( |
| 8 |
a int unsigned primary key, |
| 9 |
b char(20) character set latin1, |
| 10 |
c int unsigned |
| 11 |
) engine=ndb; |
| 12 |
|
| 13 |
--echo # restore canned backup |
| 14 |
--exec $NDB_RESTORE $NDB_RESTORE_NO_ENCR -b 1 -n 21 -r --promote-attributes $NDB_SAVED_BACKUPS/bug17275798 >> $NDB_TOOLS_OUTPUT |
| 15 |
|
| 16 |
select sum(1),sum(isnull(b)),min(b),max(b) from t1; |
| 17 |
|
| 18 |
drop table t1; |
| 19 |
|
| 20 |
--echo # bug#17395298 |
| 21 |
|
| 22 |
create table t1 ( |
| 23 |
a int primary key, |
| 24 |
b text, |
| 25 |
c int |
| 26 |
) engine=ndb; |
| 27 |
|
| 28 |
insert into t1 values (1,repeat('a',1000),10); |
| 29 |
insert into t1 values (2,repeat('b',2000),20); |
| 30 |
insert into t1 values (3,repeat('c',3000),30); |
| 31 |
|
| 32 |
--echo # run backup |
| 33 |
--source include/ndb_backup.inc |
| 34 |
|
| 35 |
rename table t1 to t1old; |
| 36 |
|
| 37 |
create table t1 ( |
| 38 |
a int primary key, |
| 39 |
c int, |
| 40 |
b text |
| 41 |
) engine=ndb; |
| 42 |
|
| 43 |
--echo # run restore |
| 44 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 45 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 46 |
|
| 47 |
select count(*) from t1 x, t1old y |
| 48 |
where x.a = y.a and x.b = y.b and x.c = y.c; |
| 49 |
|
| 50 |
drop table t1old; |
| 51 |
drop table t1; |
| 52 |
|
| 53 |
--echo # bug#17235051 : char<->binary |
| 54 |
|
| 55 |
--echo # plain restore |
| 56 |
|
| 57 |
create table t1 ( |
| 58 |
c1 char(10), |
| 59 |
c2 varchar(100), |
| 60 |
c3 varchar(1000), |
| 61 |
b1 binary(10), |
| 62 |
b2 varbinary(100), |
| 63 |
b3 varbinary(1000), |
| 64 |
d varchar(8000), |
| 65 |
a int unsigned primary key |
| 66 |
) engine=ndb character set latin1; |
| 67 |
|
| 68 |
let $ins = |
| 69 |
insert into t1 values |
| 70 |
('aaa1','bbb1','ccc1','ddd1','eee1','fff1',repeat('x',2000),1), |
| 71 |
('aaa2','bbb2','ccc2','ddd2','eee2','fff2',repeat('y',4000),2), |
| 72 |
('aaa3','bbb3','ccc3','ddd3','eee3','fff3',repeat('z',6000),3); |
| 73 |
--eval $ins |
| 74 |
|
| 75 |
let $qry = |
| 76 |
select a, |
| 77 |
trim(trailing char(0) from c1) as c1,c2,c3, |
| 78 |
trim(trailing char(0) from b1) as b1,b2,b3 |
| 79 |
from t1 order by a; |
| 80 |
--eval $qry |
| 81 |
|
| 82 |
--echo # run backup |
| 83 |
--source include/ndb_backup.inc |
| 84 |
|
| 85 |
drop table t1; |
| 86 |
|
| 87 |
create table t1 ( |
| 88 |
b1 char(10), |
| 89 |
b2 varchar(100), |
| 90 |
b3 varchar(1000), |
| 91 |
c1 binary(10), |
| 92 |
c2 varbinary(100), |
| 93 |
c3 varbinary(1000), |
| 94 |
d varchar(8000), |
| 95 |
a int unsigned primary key |
| 96 |
) engine=ndb character set latin1; |
| 97 |
|
| 98 |
--echo # run restore |
| 99 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 100 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 101 |
|
| 102 |
--eval $qry |
| 103 |
|
| 104 |
drop table t1; |
| 105 |
|
| 106 |
--echo # staging restore |
| 107 |
|
| 108 |
create table t1 ( |
| 109 |
c1 char(10), |
| 110 |
c2 varchar(100), |
| 111 |
c3 varchar(1000), |
| 112 |
b1 binary(10), |
| 113 |
b2 varbinary(100), |
| 114 |
b3 varbinary(1000), |
| 115 |
d varchar(8000), |
| 116 |
a int unsigned primary key |
| 117 |
) engine=ndb character set latin1; |
| 118 |
|
| 119 |
--eval $ins |
| 120 |
--eval $qry |
| 121 |
|
| 122 |
--echo # run backup |
| 123 |
--source include/ndb_backup.inc |
| 124 |
|
| 125 |
drop table t1; |
| 126 |
|
| 127 |
create table t1 ( |
| 128 |
b1 char(10), |
| 129 |
b2 varchar(100), |
| 130 |
b3 varchar(1000), |
| 131 |
c1 binary(10), |
| 132 |
c2 varbinary(100), |
| 133 |
c3 varbinary(1000), |
| 134 |
d text, |
| 135 |
a int unsigned primary key |
| 136 |
) engine=ndb character set latin1; |
| 137 |
|
| 138 |
--echo # run restore |
| 139 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 140 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 141 |
|
| 142 |
--eval $qry |
| 143 |
|
| 144 |
drop table t1; |
| 145 |
|
| 146 |
--echo # create tablespace |
| 147 |
|
| 148 |
create logfile group lg1 |
| 149 |
add undofile 'undofile1.dat' |
| 150 |
initial_size 8M |
| 151 |
undo_buffer_size 1M |
| 152 |
engine=ndb; |
| 153 |
|
| 154 |
create tablespace ts1 |
| 155 |
add datafile 'datafile1.dat' |
| 156 |
use logfile group lg1 |
| 157 |
initial_size 96M |
| 158 |
engine=ndb; |
| 159 |
|
| 160 |
--echo # bug#17235051 : char<->text |
| 161 |
|
| 162 |
create table t1 ( |
| 163 |
b text, |
| 164 |
c varchar(8000) character set latin1, |
| 165 |
d text, |
| 166 |
a int unsigned primary key |
| 167 |
) engine=ndb; |
| 168 |
|
| 169 |
insert into t1 values (repeat('a',3333),repeat('b',5555),repeat('c',7777),1); |
| 170 |
insert into t1 values (repeat('d',7777),repeat('e',5555),repeat('f',3333),2); |
| 171 |
insert into t1 values (null,repeat('h',5555),repeat('i',3333),3); |
| 172 |
insert into t1 values (repeat('j',7777),null,repeat('l',3333),4); |
| 173 |
insert into t1 values (repeat('m',7777),repeat('n',5555),null,5); |
| 174 |
|
| 175 |
--let $qry = select count(*),sum(crc32(concat(a,ifnull(b,'x'),ifnull(c,'y'),ifnull(d,'z')))) from t1 |
| 176 |
--eval $qry |
| 177 |
|
| 178 |
--echo # run backup |
| 179 |
--source include/ndb_backup.inc |
| 180 |
|
| 181 |
drop table t1; |
| 182 |
|
| 183 |
create table t1 ( |
| 184 |
b varchar(8000) character set latin1, |
| 185 |
c text, |
| 186 |
d text, |
| 187 |
a int unsigned primary key |
| 188 |
) engine=ndb; |
| 189 |
|
| 190 |
--echo # run restore |
| 191 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -A -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 192 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -A -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 193 |
|
| 194 |
--eval $qry |
| 195 |
|
| 196 |
drop table t1; |
| 197 |
|
| 198 |
--echo # bug#17235051 : remap columns and missing columns |
| 199 |
|
| 200 |
create table t1 ( |
| 201 |
x int, |
| 202 |
a int primary key auto_increment, |
| 203 |
b int, |
| 204 |
c bigint, |
| 205 |
y int, |
| 206 |
d varchar(8000) character set latin1 |
| 207 |
) engine=ndb; |
| 208 |
|
| 209 |
insert into t1 (x,b,c,d) values (1,10,100,repeat('d',30)); |
| 210 |
let $i=8; |
| 211 |
while ($i) |
| 212 |
{ |
| 213 |
eval insert into t1 (x,b,c,d) select x*2,b*3,c*4,concat(d,d) from t1; |
| 214 |
dec $i; |
| 215 |
} |
| 216 |
|
| 217 |
select count(*),max(a),max(b),max(c),max(length(d)) from t1; |
| 218 |
|
| 219 |
# non-deterministic??? try something else |
| 220 |
#select sum(crc32(concat(a,b,c,d))) from t1; |
| 221 |
|
| 222 |
--echo # run backup |
| 223 |
--source include/ndb_backup.inc |
| 224 |
|
| 225 |
rename table t1 to t1old; |
| 226 |
|
| 227 |
create table t1 ( |
| 228 |
d text, |
| 229 |
z char(10), |
| 230 |
b int, |
| 231 |
w char(10), |
| 232 |
c bigint, |
| 233 |
a int primary key auto_increment |
| 234 |
) engine=ndb; |
| 235 |
|
| 236 |
--echo # run restore |
| 237 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --exclude-missing-columns -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 238 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --exclude-missing-columns -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 239 |
|
| 240 |
select count(*),max(a),max(b),max(c),max(length(d)) from t1; |
| 241 |
|
| 242 |
select count(*) from t1 x, t1old y |
| 243 |
where x.a = y.a and x.b = y.b and x.c = y.c and x.d = y.d; |
| 244 |
|
| 245 |
drop table t1old; |
| 246 |
drop table t1; |
| 247 |
|
| 248 |
--echo # bug#17235051 : lossy conversions |
| 249 |
|
| 250 |
create table t1 ( |
| 251 |
a char(1) primary key, |
| 252 |
b text, |
| 253 |
c varchar(10) character set latin1 |
| 254 |
) engine=ndb; |
| 255 |
|
| 256 |
insert into t1 values ('a',concat('x',repeat('a',1000)),'0123456789'); |
| 257 |
insert into t1 values ('b',concat('y',repeat('b',2000)),'012345'); |
| 258 |
insert into t1 values ('c',concat('z',repeat('c',3000)),'01234'); |
| 259 |
|
| 260 |
let $qry = |
| 261 |
select a,length(b),trim(trailing a from b),c |
| 262 |
from t1 order by a; |
| 263 |
--eval $qry |
| 264 |
|
| 265 |
--echo # run backup |
| 266 |
--source include/ndb_backup.inc |
| 267 |
|
| 268 |
drop table t1; |
| 269 |
|
| 270 |
create table t1 ( |
| 271 |
a char(1) primary key, |
| 272 |
b varchar(2001) character set latin1, |
| 273 |
c varchar(5) character set latin1 |
| 274 |
) engine=ndb; |
| 275 |
|
| 276 |
--echo # run restore |
| 277 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 278 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 279 |
|
| 280 |
--eval $qry |
| 281 |
|
| 282 |
drop table t1; |
| 283 |
|
| 284 |
--echo # bug#17235051 : char<->text + disk data |
| 285 |
|
| 286 |
create table t1old ( |
| 287 |
a int unsigned primary key auto_increment, |
| 288 |
b text, |
| 289 |
c varchar(8000) character set latin1, |
| 290 |
d text, |
| 291 |
e varchar(20), |
| 292 |
f int |
| 293 |
) engine=ndb; |
| 294 |
|
| 295 |
insert into t1old (b,c,d,e,f) |
| 296 |
values (repeat('b',20),repeat('c',30),repeat('d',40),'e',1); |
| 297 |
let $i=8; |
| 298 |
while ($i) |
| 299 |
{ |
| 300 |
eval insert into t1old (b,c,d,e,f) |
| 301 |
select concat(b,c),concat(c,d),concat(d,b),concat(e,'e'),2*f |
| 302 |
from t1old; |
| 303 |
dec $i; |
| 304 |
} |
| 305 |
select count(*),max(length(b)),max(length(c)),max(length(d)),max(length(e)),max(f) |
| 306 |
from t1old; |
| 307 |
|
| 308 |
let $qry = |
| 309 |
select count(*) from t1 x, t1old y |
| 310 |
where x.a = y.a and x.b = y.b and x.c = y.c and x.d = y.d and x.e = y.e and x.f = y.f; |
| 311 |
let $cre1 = |
| 312 |
create table t1 ( |
| 313 |
a int unsigned primary key auto_increment, |
| 314 |
b text, |
| 315 |
c varchar(8000) character set latin1, |
| 316 |
d text, |
| 317 |
e varchar(20), |
| 318 |
f int |
| 319 |
) engine=ndb; |
| 320 |
|
| 321 |
let $cre2 = |
| 322 |
create table t1 ( |
| 323 |
e varchar(20), |
| 324 |
f int, |
| 325 |
a int unsigned primary key auto_increment, |
| 326 |
b varchar(8000) character set latin1, |
| 327 |
c text, |
| 328 |
d text |
| 329 |
) engine=ndb; |
| 330 |
|
| 331 |
--echo # restore mem->mem |
| 332 |
|
| 333 |
--eval $cre1 |
| 334 |
insert into t1 select * from t1old; |
| 335 |
--eval $qry |
| 336 |
--echo # run backup |
| 337 |
--source include/ndb_backup.inc |
| 338 |
drop table t1; |
| 339 |
--eval $cre2 |
| 340 |
--echo # run restore |
| 341 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -A -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 342 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -A -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 343 |
--eval $qry |
| 344 |
drop table t1; |
| 345 |
|
| 346 |
--echo # restore disk->disk |
| 347 |
|
| 348 |
--eval $cre1 tablespace ts1 storage disk |
| 349 |
insert into t1 select * from t1old; |
| 350 |
--eval $qry |
| 351 |
--echo # run backup |
| 352 |
--source include/ndb_backup.inc |
| 353 |
drop table t1; |
| 354 |
--eval $cre2 tablespace ts1 storage disk |
| 355 |
--echo # run restore |
| 356 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -A -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 357 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -A -L $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 358 |
--eval $qry |
| 359 |
drop table t1; |
| 360 |
|
| 361 |
drop table t1old; |
| 362 |
|
| 363 |
--echo # bug#17235051 : hybrid failure |
| 364 |
# would fail in obsolete hybrid solution with 738 (Record too big) |
| 365 |
|
| 366 |
create table t1 ( |
| 367 |
a int primary key, |
| 368 |
b varchar(5000), |
| 369 |
c varchar(5000) |
| 370 |
) engine=ndb character set latin1; |
| 371 |
|
| 372 |
insert into t1 values (1,null,null); |
| 373 |
select * from t1; |
| 374 |
|
| 375 |
--echo # run backup |
| 376 |
--source include/ndb_backup.inc |
| 377 |
|
| 378 |
drop table t1; |
| 379 |
|
| 380 |
create table t1 ( |
| 381 |
a int primary key, |
| 382 |
b text, |
| 383 |
c varchar(10000) character set latin1 |
| 384 |
) engine=ndb; |
| 385 |
|
| 386 |
--echo # run restore |
| 387 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 388 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -A $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 389 |
|
| 390 |
select * from t1; |
| 391 |
drop table t1; |
| 392 |
|
| 393 |
--echo # Ignore dynamic column diffs between staging and 'main' |
| 394 |
--echo # If backed-up had dynamic (due to online alter), and |
| 395 |
--echo # new does not (due to lack of alter), staging table |
| 396 |
--echo # should not care. |
| 397 |
|
| 398 |
create table t1( |
| 399 |
a int unsigned primary key, |
| 400 |
b varchar(6144) character set latin1 |
| 401 |
) engine=ndb; |
| 402 |
|
| 403 |
--echo # alter causing varchar to become 'dynamic' |
| 404 |
|
| 405 |
alter table t1 add column c int; |
| 406 |
show warnings; |
| 407 |
|
| 408 |
insert into t1 values (1,repeat('b',2000), 10); |
| 409 |
insert into t1 values (2,repeat('t',2000), 20); |
| 410 |
insert into t1 values (3,repeat('g',2000), 30); |
| 411 |
|
| 412 |
--echo # run backup |
| 413 |
--source include/ndb_backup.inc |
| 414 |
|
| 415 |
rename table t1 to t1old; |
| 416 |
|
| 417 |
--echo # create t1 with text + without alter (not dynamic by default) |
| 418 |
|
| 419 |
create table t1( |
| 420 |
a int unsigned primary key, |
| 421 |
b text, |
| 422 |
c int |
| 423 |
) engine=ndb; |
| 424 |
|
| 425 |
--echo # run restore |
| 426 |
|
| 427 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 428 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 429 |
|
| 430 |
select count(*) from t1 x, t1old y |
| 431 |
where x.a = y.a and x.b = y.b and x.c = y.c; |
| 432 |
|
| 433 |
drop table t1old; |
| 434 |
drop table t1; |
| 435 |
|
| 436 |
--echo # bug#18875137: ndb_restore type conversions |
| 437 |
|
| 438 |
--echo # run restore with lossy conversions |
| 439 |
create table text2text (pk int primary key, |
| 440 |
t1 tinytext, t2 text, t3 mediumtext, t4 longtext, |
| 441 |
t5 tinytext, t6 text, t7 mediumtext, t8 longtext, |
| 442 |
t9 tinytext, t10 text, t11 mediumtext, t12 longtext, |
| 443 |
t13 tinytext, t14 text, t15 mediumtext, t16 longtext)engine=NDB; |
| 444 |
insert into text2text values(1, |
| 445 |
REPEAT("A",255), REPEAT("A",5000), REPEAT("A",65536), REPEAT("A", 30000), |
| 446 |
REPEAT("A",255), REPEAT("A",5000), REPEAT("A",65537), REPEAT("A", 30000), |
| 447 |
REPEAT("A",255), REPEAT("A",5000), REPEAT("A",65540), REPEAT("A", 30000), |
| 448 |
NULL, NULL, NULL, NULL); |
| 449 |
insert into text2text values(2, "", "", "", "", "", "", "", "", "", "", "", "", NULL, NULL, NULL, NULL); |
| 450 |
insert into text2text values(3, |
| 451 |
REPEAT(" -,.;",51), REPEAT(" -,.;",1000), REPEAT(" -,.;",2000), REPEAT(" -,.;", 6000), |
| 452 |
REPEAT(" -,.;",51), REPEAT(" -,.;",1000), REPEAT(" -,.;",2001), REPEAT(" -,.;", 6000), |
| 453 |
REPEAT(" -,.;",51), REPEAT(" -,.;",1000), REPEAT(" -,.;",2002), REPEAT(" -,.;", 6000), |
| 454 |
NULL, NULL, NULL, NULL); |
| 455 |
insert into text2text values(4, |
| 456 |
REPEAT("12345",51), REPEAT("12345",1000), REPEAT("12345",2000), REPEAT("12345", 6000), |
| 457 |
REPEAT("12345",51), REPEAT("12345",1000), REPEAT("12345",2001), REPEAT("12345", 6000), |
| 458 |
REPEAT("12345",51), REPEAT("12345",1000), REPEAT("12345",2002), REPEAT("12345", 6000), |
| 459 |
NULL, NULL, NULL, NULL); |
| 460 |
insert into text2text values(5, |
| 461 |
REPEAT("abcde",51), REPEAT("abcde",1000), REPEAT("abcde",2000), REPEAT("abcde", 6000), |
| 462 |
REPEAT("abcde",51), REPEAT("abcde",1000), REPEAT("abcde",2001), REPEAT("abcde", 6000), |
| 463 |
REPEAT("abcde",51), REPEAT("abcde",1000), REPEAT("abcde",2002), REPEAT("abcde", 6000), |
| 464 |
NULL, NULL, NULL, NULL); |
| 465 |
insert into text2text values(6, |
| 466 |
REPEAT(" ",51), REPEAT(" ",1000), REPEAT(" ",2000), REPEAT(" ", 6000), |
| 467 |
REPEAT(" ",51), REPEAT(" ",1000), REPEAT(" ",2001), REPEAT(" ", 6000), |
| 468 |
REPEAT(" ",51), REPEAT(" ",1000), REPEAT(" ",2002), REPEAT(" ", 6000), |
| 469 |
NULL, NULL, NULL, NULL); |
| 470 |
insert into text2text values(7, |
| 471 |
REPEAT("a%d4 ",51), REPEAT("a%d4 ",1000), REPEAT("a%d4 ",2000), REPEAT("a%d4 ", 6000), |
| 472 |
REPEAT("a%d4 ",51), REPEAT("a%d4 ",1000), REPEAT("a%d4 ",2001), REPEAT("a%d4 ", 6000), |
| 473 |
REPEAT("a%d4 ",51), REPEAT("a%d4 ",1000), REPEAT("a%d4 ",2002), REPEAT("a%d4 ", 6000), |
| 474 |
NULL, NULL, NULL, NULL); |
| 475 |
insert into text2text values(8, |
| 476 |
NULL, NULL, NULL, NULL, |
| 477 |
NULL, NULL, NULL, NULL, |
| 478 |
NULL, NULL, NULL, NULL, |
| 479 |
NULL, NULL, NULL, NULL); |
| 480 |
|
| 481 |
--echo # run backup |
| 482 |
--source include/ndb_backup.inc |
| 483 |
|
| 484 |
drop table text2text; |
| 485 |
create table text2text (pk int primary key, |
| 486 |
t1 text, t2 mediumtext, t3 longtext, t4 tinytext, |
| 487 |
t5 mediumtext, t6 longtext, t7 tinytext, t8 text, |
| 488 |
t9 longtext, t10 tinytext, t11 text, t12 mediumtext, |
| 489 |
t13 text, t14 mediumtext, t15 longtext, t16 tinytext)engine=NDB; |
| 490 |
|
| 491 |
--echo # run restore |
| 492 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 493 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 494 |
|
| 495 |
--echo # run ndb_select_all to print restored table |
| 496 |
--exec $NDB_SELECT_ALL -d test text2text -o PRIMARY |
| 497 |
--echo # run select query to see truncation in mysqld |
| 498 |
select LENGTH(t1), LENGTH(t2), LENGTH(t3), LENGTH(t4), LENGTH(t5), LENGTH(t6), LENGTH(t7), LENGTH(t8), LENGTH(t9), LENGTH(t10), LENGTH(t11), LENGTH(t12) from text2text order by pk; |
| 499 |
|
| 500 |
--echo # run restore with no lossy conversions |
| 501 |
drop table text2text; |
| 502 |
create table text2text (pk int primary key, |
| 503 |
t1 text, t2 mediumtext, t3 longtext, t4 tinytext, |
| 504 |
t5 mediumtext, t6 longtext, t7 tinytext, t8 text, |
| 505 |
t9 longtext, t10 tinytext, t11 text, t12 mediumtext, |
| 506 |
t13 text, t14 mediumtext, t15 longtext, t16 tinytext)engine=NDB; |
| 507 |
|
| 508 |
--echo # run restore |
| 509 |
--error 1 |
| 510 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 511 |
--echo # ndb_restore fails with error 1 |
| 512 |
--error 1 |
| 513 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 514 |
--echo # ndb_restore fails with error 1 |
| 515 |
|
| 516 |
|
| 517 |
--echo # restore NULL values into non-nullable columns |
| 518 |
drop table text2text; |
| 519 |
create table text2text (pk int primary key, |
| 520 |
t1 text not null, t2 mediumtext not null, t3 longtext not null, t4 tinytext not null, |
| 521 |
t5 mediumtext not null, t6 longtext not null, t7 tinytext not null, t8 text not null, |
| 522 |
t9 longtext not null, t10 tinytext not null, t11 text not null, t12 mediumtext not null, |
| 523 |
t13 text not null, t14 mediumtext not null, t15 longtext not null, t16 tinytext not null)engine=NDB; |
| 524 |
--echo # run restore |
| 525 |
--error 1 |
| 526 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 527 |
--echo # ndb_restore fails with error 1, staging table suffixes 'ST1-<id>' depend upon total #ldms |
| 528 |
--error 0,1 |
| 529 |
--exec $NDB_DROP_TABLE -d test text2text\$ST1-1-0 >> $NDB_TOOLS_OUTPUT |
| 530 |
--error 0,1 |
| 531 |
--exec $NDB_DROP_TABLE -d test text2text\$ST1-2-0 >> $NDB_TOOLS_OUTPUT |
| 532 |
--error 0,1 |
| 533 |
--exec $NDB_DROP_TABLE -d test text2text\$ST1-3-0 >> $NDB_TOOLS_OUTPUT |
| 534 |
--error 0,1 |
| 535 |
--exec $NDB_DROP_TABLE -d test text2text\$ST1-4-0 >> $NDB_TOOLS_OUTPUT |
| 536 |
--error 1 |
| 537 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 538 |
--echo # ndb_restore fails with error 1, staging table suffixes 'ST1-<id>' depend upon total #ldms |
| 539 |
--error 0,1 |
| 540 |
--exec $NDB_DROP_TABLE -d test text2text\$ST2-1-0 >> $NDB_TOOLS_OUTPUT |
| 541 |
--error 0,1 |
| 542 |
--exec $NDB_DROP_TABLE -d test text2text\$ST2-2-0 >> $NDB_TOOLS_OUTPUT |
| 543 |
--error 0,1 |
| 544 |
--exec $NDB_DROP_TABLE -d test text2text\$ST2-3-0 >> $NDB_TOOLS_OUTPUT |
| 545 |
--error 0,1 |
| 546 |
--exec $NDB_DROP_TABLE -d test text2text\$ST2-4-0 >> $NDB_TOOLS_OUTPUT |
| 547 |
|
| 548 |
--echo # restore to text column with different charset |
| 549 |
drop table text2text; |
| 550 |
create table text2text (pk int primary key, |
| 551 |
t1 text character set utf8, t2 mediumtext character set utf8, t3 longtext character set utf8, t4 tinytext character set utf8, |
| 552 |
t5 mediumtext character set utf8, t6 longtext character set utf8, t7 tinytext character set utf8, t8 text character set utf8, |
| 553 |
t9 longtext character set utf8, t10 tinytext character set utf8, t11 text character set utf8, t12 mediumtext character set utf8, |
| 554 |
t13 text character set utf8, t14 mediumtext character set utf8, t15 longtext character set utf8, t16 tinytext character set utf8)engine=NDB; |
| 555 |
|
| 556 |
--echo # run restore |
| 557 |
--error 1 |
| 558 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 559 |
--echo # ndb_restore fails with error 1 |
| 560 |
--error 1 |
| 561 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 562 |
--echo # ndb_restore fails with error 1 |
| 563 |
|
| 564 |
--echo # restore with mix of staging and built-in conversions |
| 565 |
drop table text2text; |
| 566 |
create table text2text (pk mediumint primary key, |
| 567 |
t1 text, t2 mediumtext, t3 longtext, t4 tinytext, |
| 568 |
t5 mediumtext, t6 longtext, t7 tinytext, t8 text, |
| 569 |
t9 longtext, t10 tinytext, t11 text, t12 mediumtext, |
| 570 |
t13 text, t14 mediumtext, t15 longtext, t16 tinytext)engine=NDB; |
| 571 |
|
| 572 |
--echo # run restore |
| 573 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --lossy-conversions --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 574 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --lossy-conversions --promote-attributes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 575 |
|
| 576 |
--echo # run ndb_select_all to print restored table |
| 577 |
--exec $NDB_SELECT_ALL -d test text2text -o PRIMARY |
| 578 |
|
| 579 |
drop table text2text; |
| 580 |
|
| 581 |
--echo # restore with pk built-in conversion and blob staging conversion |
| 582 |
create table text2text(id char(10) character set latin1 primary key, val text)engine=ndb; |
| 583 |
insert into text2text values("1111111111", REPEAT("A", 500)); |
| 584 |
insert into text2text values("2222222222", REPEAT("B", 500)); |
| 585 |
|
| 586 |
--echo # run backup |
| 587 |
--source include/ndb_backup.inc |
| 588 |
|
| 589 |
drop table text2text; |
| 590 |
create table text2text(id varchar(5) character set latin1 primary key, val mediumtext)engine=ndb; |
| 591 |
|
| 592 |
--echo # run restore |
| 593 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 594 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 595 |
|
| 596 |
--echo # run ndb_select_all to print restored table |
| 597 |
--exec $NDB_SELECT_ALL -d test text2text -o PRIMARY |
| 598 |
|
| 599 |
--echo # ndb_restore TEXT -> TINYTEXT truncation with utf8 |
| 600 |
drop table text2text; |
| 601 |
set character_set_client=utf8; |
| 602 |
create table text2text(id int primary key, val text character set utf8)engine=ndb; |
| 603 |
insert into text2text values(11111, REPEAT(UNHEX("E38182"), 100)); |
| 604 |
insert into text2text values(22222, CONCAT("A",REPEAT(UNHEX("E38182"), 100))); |
| 605 |
|
| 606 |
--echo # run backup |
| 607 |
--source include/ndb_backup.inc |
| 608 |
|
| 609 |
drop table text2text; |
| 610 |
create table text2text(id int primary key, val tinytext character set utf8)engine=ndb; |
| 611 |
|
| 612 |
--echo # run restore |
| 613 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 614 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r --promote-attributes --lossy-conversions $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 615 |
|
| 616 |
--echo # run ndb_select_all to see charset-aware truncation in ndb |
| 617 |
--exec $NDB_SELECT_ALL -d test text2text -o PRIMARY |
| 618 |
|
| 619 |
--echo # run mysql select to see charset-aware truncation in mysqld |
| 620 |
--echo # truncation in pk-based read |
| 621 |
select length(val), char_length(val) from text2text where id = 22222; |
| 622 |
--echo # truncation in scan |
| 623 |
select length(val), char_length(val) from text2text order by id; |
| 624 |
|
| 625 |
drop table text2text; |
| 626 |
|
| 627 |
--echo # drop tablespace |
| 628 |
|
| 629 |
alter tablespace ts1 |
| 630 |
drop datafile 'datafile1.dat'; |
| 631 |
|
| 632 |
drop tablespace ts1; |
| 633 |
|
| 634 |
drop logfile group lg1 |
| 635 |
engine=ndb; |
| 636 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 637 |
--remove_file $NDB_TOOLS_OUTPUT |