| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/have_ndb_debug.inc |
| 3 |
--source suite/ndb/include/backup_restore_setup.inc |
| 4 |
|
| 5 |
--echo Check behaviour when restoring with remap |
| 6 |
--echo and log content. |
| 7 |
|
| 8 |
--let $backup_type=2 |
| 9 |
|
| 10 |
while ($backup_type) |
| 11 |
{ |
| 12 |
--echo Backup type $backup_type |
| 13 |
create table t1 (a int auto_increment primary key, b int, c text) engine=ndb; |
| 14 |
|
| 15 |
insert into t1 (b,c) values |
| 16 |
(1, repeat('B', 2000)), |
| 17 |
(2, repeat('J', 3000)), |
| 18 |
(3, repeat('C', 3500)), |
| 19 |
(4, repeat('T', 3300)), |
| 20 |
(5, repeat('S', 1234)), |
| 21 |
(6, repeat('G', 3333)); |
| 22 |
|
| 23 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 24 |
|
| 25 |
--echo Cause backup stall |
| 26 |
--exec $NDB_MGM -e "all error 10039" >> $NDB_TOOLS_OUTPUT |
| 27 |
|
| 28 |
if ($backup_type == 1) |
| 29 |
{ |
| 30 |
--let $start_backup_extra=SNAPSHOTSTART |
| 31 |
} |
| 32 |
|
| 33 |
--source suite/ndb/t/ndb_backup_nowait_start.inc |
| 34 |
|
| 35 |
# Use autoinc value |
| 36 |
insert into t1 (b,c) values |
| 37 |
(7, repeat('D', 999)); |
| 38 |
|
| 39 |
# Specify auto-inc key |
| 40 |
insert into t1 (a,b,c) values (1000, 1000, repeat('MU', 444)); |
| 41 |
|
| 42 |
delete from t1 where b=4; |
| 43 |
|
| 44 |
# Update primary key |
| 45 |
update t1 set a=1010 where a=2; |
| 46 |
|
| 47 |
# Specify auto-inc key, and update [and delete] [and insert] in a transaction |
| 48 |
# with + without blob |
| 49 |
begin; |
| 50 |
# ins->upd |
| 51 |
# blob |
| 52 |
insert into t1 (a,b,c) values (500, 500, repeat('AR', 1000)); |
| 53 |
update t1 set c=repeat('AG', 3000) where a=500; |
| 54 |
|
| 55 |
# !blob |
| 56 |
insert into t1 (a,b,c) values (501, 501, repeat('AR', 1000)); |
| 57 |
update t1 set b=5010 where a=501; |
| 58 |
commit; |
| 59 |
|
| 60 |
begin; |
| 61 |
# ins->upd->del |
| 62 |
# blob |
| 63 |
insert into t1 (a,b,c) values (502, 502, repeat('AR', 1500)); |
| 64 |
update t1 set c=repeat('AG', 2000) where a=502; |
| 65 |
delete from t1 where a=502; |
| 66 |
|
| 67 |
# !blob |
| 68 |
insert into t1 (a,b,c) values (503, 503, repeat('AR', 1500)); |
| 69 |
update t1 set b=5030 where a=503; |
| 70 |
delete from t1 where a=503; |
| 71 |
commit; |
| 72 |
|
| 73 |
begin; |
| 74 |
# ins->upd->del->ins |
| 75 |
# blob |
| 76 |
insert into t1 (a,b,c) values (504, 504, repeat('AR', 2000)); |
| 77 |
update t1 set c=repeat('AG', 2500) where a=504; |
| 78 |
delete from t1 where a=504; |
| 79 |
insert into t1 (a,b,c) values (504, 5040, repeat('ON', 2500)); |
| 80 |
|
| 81 |
# !blob |
| 82 |
insert into t1 (a,b,c) values (505, 505, repeat('AR', 2000)); |
| 83 |
update t1 set b=5050 where a=505; |
| 84 |
delete from t1 where a=505; |
| 85 |
insert into t1 (a,b,c) values (505, 50500, repeat('ON', 2000)); |
| 86 |
commit; |
| 87 |
|
| 88 |
# Specify auto-inc key, and update [and delete] [and insert] in a transaction |
| 89 |
# with + without blob |
| 90 |
insert into t1 (a,b,c) values (510, 510, repeat('ON', 1500)); |
| 91 |
insert into t1 (a,b,c) values (511, 511, repeat('AG', 2000)); |
| 92 |
insert into t1 (a,b,c) values (512, 512, repeat('AR', 2500)); |
| 93 |
insert into t1 (a,b,c) values (513, 513, repeat('TR', 2500)); |
| 94 |
insert into t1 (a,b,c) values (514, 514, repeat('IZ', 2500)); |
| 95 |
insert into t1 (a,b,c) values (515, 515, repeat('EA', 2500)); |
| 96 |
|
| 97 |
|
| 98 |
begin; |
| 99 |
# update->delete |
| 100 |
# blob |
| 101 |
update t1 set c=repeat('AG', 2700) where a=510; |
| 102 |
delete from t1 where a=510; |
| 103 |
|
| 104 |
# !blob |
| 105 |
update t1 set b=5110 where a=511; |
| 106 |
delete from t1 where a=511; |
| 107 |
commit; |
| 108 |
|
| 109 |
begin; |
| 110 |
# update->delete->insert |
| 111 |
# blob |
| 112 |
update t1 set c=repeat('TR', 1300) where a=512; |
| 113 |
delete from t1 where a=512; |
| 114 |
insert into t1 (a,b,c) values (512, 5120, repeat('IZ', 2499)); |
| 115 |
|
| 116 |
# !blob |
| 117 |
update t1 set b=5130 where a=513; |
| 118 |
delete from t1 where a=513; |
| 119 |
insert into t1 (a,b,c) values (513, 51300, repeat('ON', 1788)); |
| 120 |
commit; |
| 121 |
|
| 122 |
begin; |
| 123 |
# update->delete->insert->update |
| 124 |
# blob |
| 125 |
update t1 set c=repeat('ON', 1234) where a=514; |
| 126 |
delete from t1 where a=514; |
| 127 |
insert into t1 (a,b,c) values (514, 5140, repeat('EA', 1111)); |
| 128 |
update t1 set c=repeat('AG', 3000) where a=514; |
| 129 |
|
| 130 |
# !blob |
| 131 |
update t1 set b=5150 where a=515; |
| 132 |
delete from t1 where a=515; |
| 133 |
insert into t1 (a,b,c) values (515, 51500, repeat('TR', 2222)); |
| 134 |
update t1 set b=515000 where a=515; |
| 135 |
commit; |
| 136 |
|
| 137 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 138 |
show create table t1; |
| 139 |
|
| 140 |
--exec $NDB_MGM -e "all error 0" >> $NDB_TOOLS_OUTPUT |
| 141 |
--source suite/ndb/t/ndb_backup_nowait_wait.inc |
| 142 |
|
| 143 |
drop table test.t1; |
| 144 |
|
| 145 |
--echo Restore data |
| 146 |
|
| 147 |
create table t1 (a int auto_increment primary key, b int, c text) engine=ndb; |
| 148 |
|
| 149 |
--echo Node 1 |
| 150 |
--exec $NDB_RESTORE -b $the_backup_id -n 1 -r -x test.t1.a:offset:4000 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 151 |
--echo Node 2 |
| 152 |
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r -x test.t1.a:offset:4000 $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT |
| 153 |
|
| 154 |
select a, b, length(c), sha1(c) from t1 order by a; |
| 155 |
|
| 156 |
--echo Check restored auto-inc metadata : |
| 157 |
--echo Expect that auto-increment next is 5011, e.g. > highest remapped row that |
| 158 |
--echo existed at end of backup time |
| 159 |
--echo (note that SNAPSHOTSTART does not snapshot autoinc metadata) |
| 160 |
--echo |
| 161 |
show create table t1; |
| 162 |
|
| 163 |
drop table test.t1; |
| 164 |
|
| 165 |
--dec $backup_type |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 170 |
--remove_file $NDB_TOOLS_OUTPUT |