| 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 t1(id int primary key, val blob) engine=ndb; |
| 6 |
|
| 7 |
--disable_query_log |
| 8 |
let $i= 100; |
| 9 |
while ($i) |
| 10 |
{ |
| 11 |
eval INSERT INTO t1 values ($i, REPEAT('$i', 1000)); |
| 12 |
dec $i; |
| 13 |
} |
| 14 |
--enable_query_log |
| 15 |
|
| 16 |
--echo "Backup not started, ndbinfo should show zero backup buffer usage" |
| 17 |
select count(*) from ndbinfo.logbuffers where log_type like "BACKUP%" and used > 0; |
| 18 |
|
| 19 |
--exec $NDB_MGM -e "ALL ERROR 10039" >> $NDB_TOOLS_OUTPUT |
| 20 |
--exec $NDB_MGM -e "start backup wait started" >> $NDB_TOOLS_OUTPUT |
| 21 |
|
| 22 |
--echo "Backup started, ndbinfo should show backup buffer usage" |
| 23 |
select count(*) from ndbinfo.logbuffers where log_type like "BACKUP%"; |
| 24 |
|
| 25 |
let $data_buf_usage_before = |
| 26 |
`select used from ndbinfo.logbuffers |
| 27 |
where node_id = 1 and log_type like 'BACKUP-DATA'`; |
| 28 |
let $log_buf_usage_before = |
| 29 |
`select used from ndbinfo.logbuffers |
| 30 |
where node_id = 1 and log_type like 'BACKUP-LOG'`; |
| 31 |
|
| 32 |
--echo "Backup data buffer and backup log buffer should not be empty" |
| 33 |
if (!$data_buf_usage_before) |
| 34 |
{ |
| 35 |
die The backup data buffer usage should not be zero; |
| 36 |
} |
| 37 |
if (!$log_buf_usage_before) |
| 38 |
{ |
| 39 |
die The backup log buffer usage should not be zero; |
| 40 |
} |
| 41 |
|
| 42 |
update t1 set val = REPEAT('x', 1000) where id < 25; |
| 43 |
|
| 44 |
let $log_buf_usage_after = |
| 45 |
`select used from ndbinfo.logbuffers |
| 46 |
where node_id = 1 and log_type like 'BACKUP-LOG'`; |
| 47 |
|
| 48 |
--echo "Backup log buffer usage should increase due to UPDATE ops during backup" |
| 49 |
if ($log_buf_usage_after == $log_buf_usage_before) |
| 50 |
{ |
| 51 |
die The backup log buffer usage failed to increase when UPDATES were executed; |
| 52 |
} |
| 53 |
|
| 54 |
# Resume backup |
| 55 |
--exec $NDB_MGM -e "ALL ERROR 0" >> $NDB_TOOLS_OUTPUT |
| 56 |
|
| 57 |
# Drop table won't go through until the backup is completed. |
| 58 |
# Retry DROP TABLE in a loop with a gap of one second between |
| 59 |
# successive attempts until backup completes, at which point |
| 60 |
# the DROP TABLE will succeed. |
| 61 |
|
| 62 |
--disable_query_log |
| 63 |
let $mysql_errno = ER_GET_ERRMSG; |
| 64 |
while($mysql_errno) |
| 65 |
{ |
| 66 |
sleep 1; |
| 67 |
--error 0,1306 |
| 68 |
drop table t1; |
| 69 |
} |
| 70 |
--enable_query_log |
| 71 |
|
| 72 |
--echo "Backup complete, backup buffer usage should return to zero" |
| 73 |
select count(*) from ndbinfo.logbuffers where log_type like "BACKUP%" and used > 0; |
| 74 |
--source suite/ndb/include/backup_restore_cleanup.inc |
| 75 |
--remove_file $NDB_TOOLS_OUTPUT |