|
| 1 | +-- source include/have_ndb.inc |
| 2 | +-- source include/not_embedded.inc |
| 3 | +-- source include/have_ndb_debug.inc |
| 4 | + |
| 5 | +use test; |
| 6 | + |
| 7 | +create table test.t1 (a varchar(20) not null, |
| 8 | + b varchar(20) not null, |
| 9 | + c varchar(20), |
| 10 | + d varchar(20), |
| 11 | + e text, |
| 12 | + primary key(a,b)) engine=ndb; |
| 13 | + |
| 14 | +insert into test.t1 values |
| 15 | + ("1a","1b",NULL,"1d", repeat('01WIFUA',1000)), |
| 16 | + ("2a","2b",NULL,"2d", repeat('02WIFUA',1000)), |
| 17 | + ("3a","3b",NULL,"3d", repeat('03WIFUA',1000)), |
| 18 | + ("4a","4b",NULL,"4d", repeat('04WIFUA',1000)), |
| 19 | + ("5a","5b",NULL,"5d", repeat('05WIFUA',1000)), |
| 20 | + ("6a","6b",NULL,"6d", repeat('06WIFUA',1000)), |
| 21 | + ("7a","7b",NULL,"7d", repeat('07WIFUA',1000)), |
| 22 | + ("8a","8b",NULL,"8d", repeat('08WIFUA',1000)), |
| 23 | + ("9a","9b",NULL,"9d", repeat('09WIFUA',1000)), |
| 24 | + ("10a","10b",NULL,"10d", repeat('10WIFUA',1000)), |
| 25 | + ("11a","11b",NULL,"11d", repeat('11WIFUA',1000)), |
| 26 | + ("12a","12b",NULL,"12d", repeat('12WIFUA',1000)), |
| 27 | + ("13a","13b",NULL,"13d", repeat('13WIFUA',1000)), |
| 28 | + ("14a","14b",NULL,"14d", repeat('14WIFUA',1000)), |
| 29 | + ("15a","15b",NULL,"15d", repeat('15WIFUA',1000)), |
| 30 | + ("16a","16b",NULL,"16d", repeat('16WIFUA',1000)); |
| 31 | + |
| 32 | +--echo Stall backup completion |
| 33 | +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all error 10039" >> $NDB_TOOLS_OUTPUT 2>&1 |
| 34 | +--echo Run backup |
| 35 | +--source suite/ndb/t/ndb_backup_nowait_start.inc |
| 36 | + |
| 37 | +--echo Make some changes which will be logged... |
| 38 | +insert into test.t1 values |
| 39 | + ("17a","17b",NULL,"17d", repeat('17WIFUA',1000)), |
| 40 | + ("18a","18b",NULL,"18d", repeat('18WIFUA',1000)), |
| 41 | + ("19a","19b",NULL,"19d", repeat('19WIFUA',1000)); |
| 42 | + |
| 43 | +update test.t1 set d=concat(d, "-modified"); |
| 44 | + |
| 45 | +delete from test.t1 where a in ("5a","18a"); |
| 46 | + |
| 47 | +--echo Allow backup to complete... |
| 48 | +--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all error 0" >> $NDB_TOOLS_OUTPUT 2>&1 |
| 49 | + |
| 50 | +--source suite/ndb/t/ndb_backup_nowait_wait.inc |
| 51 | + |
| 52 | +delete from test.t1; |
| 53 | + |
| 54 | +--echo # Normal restore using slices |
| 55 | + |
| 56 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --num-slices=3 --slice-id=0 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 57 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --num-slices=3 --slice-id=1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 58 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --num-slices=3 --slice-id=2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 59 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --num-slices=3 --slice-id=0 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 60 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --num-slices=3 --slice-id=1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 61 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --num-slices=3 --slice-id=2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 62 | + |
| 63 | +select a,b,c,d,length(e), right(e, 7) from test.t1 order by a,b; |
| 64 | + |
| 65 | +drop table test.t1; |
| 66 | + |
| 67 | +--echo # Restore with staging conversions + slices |
| 68 | +create table test.t1 (a varchar(20) not null, |
| 69 | + b varchar(20) not null, |
| 70 | + c text, |
| 71 | + d text, |
| 72 | + e text, |
| 73 | + primary key(a,b)) engine=ndb; |
| 74 | + |
| 75 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --promote-attributes --lossy-conversions --num-slices=5 --slice-id=0 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 76 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --promote-attributes --lossy-conversions --num-slices=5 --slice-id=1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 77 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --promote-attributes --lossy-conversions --num-slices=5 --slice-id=2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 78 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --promote-attributes --lossy-conversions --num-slices=5 --slice-id=3 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 79 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --promote-attributes --lossy-conversions --num-slices=5 --slice-id=4 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 80 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=0 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 81 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 82 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 83 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=3 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 84 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=4 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 85 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=5 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 86 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --promote-attributes --lossy-conversions --num-slices=7 --slice-id=6 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 87 | + |
| 88 | +select a,b,c,d,length(e), right(e, 7) from test.t1 order by a,b; |
| 89 | + |
| 90 | +drop table test.t1; |
| 91 | + |
| 92 | +--echo # Error out during restore to examine staging table names |
| 93 | + |
| 94 | +create table test.t1 (a varchar(20) not null, |
| 95 | + b varchar(20) not null, |
| 96 | + c text not null, |
| 97 | + d text not null, |
| 98 | + e text, |
| 99 | + primary key(a,b)) engine=ndb; |
| 100 | + |
| 101 | +--error 134 |
| 102 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 1 --lossy-conversions --promote-attributes --num-slices=3 --slice-id=1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 103 | +--error 134 |
| 104 | +--exec $NDB_RESTORE --no-defaults -b $the_backup_id -n 2 --lossy-conversions --promote-attributes --num-slices=3 --slice-id=1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1 |
| 105 | + |
| 106 | +--echo # Dropping staging tables |
| 107 | +--exec $NDB_DROP_TABLE --no-defaults -d test t1\$ST1-1 >> $NDB_TOOLS_OUTPUT 2>1 |
| 108 | +--exec $NDB_DROP_TABLE --no-defaults -d test t1\$ST2-1 >> $NDB_TOOLS_OUTPUT 2>1 |
| 109 | + |
| 110 | +drop table test.t1; |
0 commit comments