| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/not_windows.inc |
| 3 |
--source suite/ndb/include/backup_restore_setup.inc |
| 4 |
|
| 5 |
use test; |
| 6 |
|
| 7 |
--echo Create a table with some heavy indexing |
| 8 |
|
| 9 |
|
| 10 |
create table t1 (a int primary key, b int, c varchar(100), d int, |
| 11 |
key (a,b,c,d), |
| 12 |
key (b,a), |
| 13 |
key (b,c), |
| 14 |
key (b,d), |
| 15 |
key (c,a), |
| 16 |
key (c,d), |
| 17 |
key (d,c,b,a), |
| 18 |
key (c,b,a), |
| 19 |
key (c,b,a,d), |
| 20 |
key (b,a,d,c), |
| 21 |
key (a,d,c,b)) |
| 22 |
engine = ndb; |
| 23 |
|
| 24 |
--echo Insert some rows |
| 25 |
--disable_query_log |
| 26 |
--disable_result_log |
| 27 |
insert into test.t1 values (1,1,repeat('sh', 50), 1); |
| 28 |
insert into test.t1 select a+1, b+1, c, d+1 from test.t1; |
| 29 |
insert into test.t1 select a+2, b+2, c, d+2 from test.t1; |
| 30 |
insert into test.t1 select a+4, b+4, c, d+4 from test.t1; |
| 31 |
insert into test.t1 select a+8, b+8, c, d+8 from test.t1; |
| 32 |
insert into test.t1 select a+16, b+16, c, d+16 from test.t1; |
| 33 |
insert into test.t1 select a+32, b+32, c, d+32 from test.t1; |
| 34 |
insert into test.t1 select a+64, b+64, c, d+64 from test.t1; |
| 35 |
insert into test.t1 select a+128, b+128, c, d+128 from test.t1; |
| 36 |
insert into test.t1 select a+256, b+256, c, d+256 from test.t1; |
| 37 |
insert into test.t1 select a+512, b+512, c, d+512 from test.t1; |
| 38 |
insert into test.t1 select a+1024, b+1024, c, d+1024 from test.t1; |
| 39 |
insert into test.t1 select a+2048, b+2048, c, d+2048 from test.t1; |
| 40 |
insert into test.t1 select a+4096, b+4096, c, d+4096 from test.t1; |
| 41 |
insert into test.t1 select a+8192, b+8192, c, d+8192 from test.t1 limit 8000; |
| 42 |
insert into test.t1 select a+16384, b+16384, c, d+16384 from test.t1 limit 8000; |
| 43 |
insert into test.t1 select a+32768, b+32768, c, d+32768 from test.t1 limit 8000; |
| 44 |
insert into test.t1 select a+65536, b+65536, c, d+65536 from test.t1 limit 8000; |
| 45 |
insert into test.t1 select a+131072, b+131072, c, d+131072 from test.t1 limit 8000; |
| 46 |
|
| 47 |
--enable_query_log |
| 48 |
--enable_result_log |
| 49 |
|
| 50 |
select count(1) from test.t1; |
| 51 |
|
| 52 |
--echo Generate a backup |
| 53 |
--source include/ndb_backup.inc |
| 54 |
|
| 55 |
drop table test.t1; |
| 56 |
|
| 57 |
--echo Restore with offline (parallel) rebuild |
| 58 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -m --disable-indexes -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 59 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 --disable_indexes -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 60 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 --rebuild-indexes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 61 |
|
| 62 |
drop table test.t1; |
| 63 |
|
| 64 |
--echo Test that exclude-missing-tables does not exclude tables in rewritten databases |
| 65 |
|
| 66 |
create database dbfrom; |
| 67 |
use dbfrom; |
| 68 |
create table t1(id int primary key, val int unique) engine=ndb; |
| 69 |
insert into t1 values (1,1), (2,2), (3,3), (4,4), (5,5); |
| 70 |
|
| 71 |
--source include/ndb_backup.inc |
| 72 |
|
| 73 |
drop table t1; |
| 74 |
drop database dbfrom; |
| 75 |
|
| 76 |
--exec $NDB_RESTORE -n 1 -b $the_backup_id --disable-indexes --rewrite-database=dbfrom,dbto -m $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 77 |
--exec $NDB_RESTORE -n 1 -b $the_backup_id --rebuild-indexes --rewrite-database=dbfrom,dbto --exclude-missing-tables -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 78 |
--exec $NDB_RESTORE -n 2 -b $the_backup_id --rebuild-indexes --rewrite-database=dbfrom,dbto --exclude-missing-tables -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 79 |
|
| 80 |
create database dbto; |
| 81 |
use dbto; |
| 82 |
select * from t1 order by id; |
| 83 |
|
| 84 |
drop database dbto; |
| 85 |
|
| 86 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 87 |
--remove_file $NDB_TOOLS_OUTPUT |