| 1 |
--source include/have_ndb.inc |
| 2 |
--source have_ndb_error_insert.inc |
| 3 |
--source suite/ndb/include/backup_restore_setup.inc |
| 4 |
|
| 5 |
create table all_data (id int primary key, val int) engine=ndb; |
| 6 |
create table part_data (id int primary key, val int) engine=ndb; |
| 7 |
create table all_logs (txt varchar(512)) engine=ndb; |
| 8 |
create table part_logs (txt varchar(512)) engine=ndb; |
| 9 |
create table txt (a varchar(512)) engine=ndb; |
| 10 |
|
| 11 |
insert into part_data values (1,1), (2,2), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8); |
| 12 |
|
| 13 |
--exec $NDB_MGM -e "all error 10039" |
| 14 |
--source suite/ndb/t/ndb_backup_nowait_start.inc |
| 15 |
|
| 16 |
update part_data set val = 0; |
| 17 |
|
| 18 |
--exec $NDB_MGM -e "all error 0" |
| 19 |
--source suite/ndb/t/ndb_backup_nowait_wait.inc |
| 20 |
|
| 21 |
delete from part_data; |
| 22 |
let $node = 2; |
| 23 |
|
| 24 |
while ($node) |
| 25 |
{ |
| 26 |
let $part = 4; |
| 27 |
while ($part) |
| 28 |
{ |
| 29 |
--echo Restore data of part $part on node $node |
| 30 |
--exec $NDB_RESTORE -b $the_backup_id -n $node -r $NDB_BACKUPS-$the_backup_id/BACKUP-$the_backup_id-PART-$part-OF-4 >> $NDB_TOOLS_OUTPUT 2>&1 |
| 31 |
--echo Check that part data does not overlap with already restored data |
| 32 |
select count(*) from part_data join all_data where part_data.id = all_data.id; |
| 33 |
|
| 34 |
--echo Capture backup logs of part $part on node $node |
| 35 |
--disable_query_log |
| 36 |
--let $outfile = $MYSQLTEST_VARDIR/tmp/ndb_backup_log.txt |
| 37 |
--exec $NDB_RESTORE -b $the_backup_id -n $node --print-log $NDB_BACKUPS-$the_backup_id/BACKUP-$the_backup_id-PART-$part-OF-4 > $outfile 2>&1 |
| 38 |
truncate table txt; |
| 39 |
eval load data infile '$outfile' into table txt fields terminated by '\n'; |
| 40 |
--remove_file $outfile |
| 41 |
update txt set a = TRIM(TRAILING "\r" FROM a); |
| 42 |
insert into part_logs select * from txt where (a like 'INSERT %') or (a like 'UPDATE %') or (a like 'DELETE %'); |
| 43 |
--enable_query_log |
| 44 |
|
| 45 |
--echo Check that part logs do not overlap with logs from other parts |
| 46 |
select count(*) from part_logs join all_logs where part_logs.txt = all_logs.txt; |
| 47 |
|
| 48 |
--disable_query_log |
| 49 |
insert into all_data select * from part_data; |
| 50 |
insert into all_logs select * from part_logs; |
| 51 |
delete from part_data; |
| 52 |
delete from part_logs; |
| 53 |
--enable_query_log |
| 54 |
dec $part; |
| 55 |
} |
| 56 |
dec $node; |
| 57 |
} |
| 58 |
|
| 59 |
drop table txt; |
| 60 |
drop table part_data; |
| 61 |
drop table part_logs; |
| 62 |
drop table all_data; |
| 63 |
drop table all_logs; |
| 64 |
|
| 65 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 66 |
--remove_file $NDB_TOOLS_OUTPUT |