| 1 |
-- source include/have_ndb.inc |
| 2 |
-- source include/have_binlog_format_mixed_or_row.inc |
| 3 |
-- source include/have_debug.inc |
| 4 |
|
| 5 |
--echo Test binlog purging, especially 'automatic' purging |
| 6 |
|
| 7 |
# TODO |
| 8 |
# Manual purge |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
--echo Test expire-log-days handling as part of normal operation |
| 14 |
--echo Logs are rotated as part of transaction COMMIT (to avoid |
| 15 |
--echo a transaction being split across 2 files), rotation checks |
| 16 |
--echo expire-logs-days to decide whether to purge, and purging |
| 17 |
--echo calls into the Ndb handler to think about deleting rows |
| 18 |
--echo from ndb_binlog_index. |
| 19 |
--echo The delete from ndb_binlog_index is itself a SQL statement |
| 20 |
--echo executing *during* the COMMIT of some other transaction, |
| 21 |
--echo potentially in some other engine. Don't want to think |
| 22 |
--echo about that too closely |
| 23 |
|
| 24 |
|
| 25 |
show variables like 'log_bin'; |
| 26 |
|
| 27 |
# Commit transactions to 2 different engines so that |
| 28 |
# a single binlog file has ndb entries to delete from |
| 29 |
# mysql.ndb_binlog_index, and may decide to do this |
| 30 |
# while committing a transaction on some other engine |
| 31 |
# myisam or innodb will do. |
| 32 |
|
| 33 |
use test; |
| 34 |
create table test.tm (b varchar(1000)) engine=myisam; |
| 35 |
create table test.tn (b varchar(1000)) engine=ndb; |
| 36 |
|
| 37 |
delimiter %; |
| 38 |
create procedure go_forth_and_make_binlog(loops int) |
| 39 |
begin |
| 40 |
set @x = 0; |
| 41 |
repeat |
| 42 |
insert into test.tm values (repeat('C', 1000)); |
| 43 |
insert into test.tm values (repeat('C', 1000)); |
| 44 |
insert into test.tm values (repeat('C', 1000)); |
| 45 |
insert into test.tm values (repeat('C', 1000)); |
| 46 |
insert into test.tm values (repeat('C', 1000)); |
| 47 |
insert into test.tm values (repeat('C', 1000)); |
| 48 |
insert into test.tm values (repeat('C', 1000)); |
| 49 |
insert into test.tn values (repeat('N', 1000)); |
| 50 |
delete from test.tm; |
| 51 |
delete from test.tn; |
| 52 |
select sleep(0.1); |
| 53 |
set @x = @x + 1; |
| 54 |
until @x = loops |
| 55 |
end repeat; |
| 56 |
end% |
| 57 |
|
| 58 |
delimiter ;% |
| 59 |
|
| 60 |
--disable_result_log |
| 61 |
call go_forth_and_make_binlog(40); |
| 62 |
--enable_result_log |
| 63 |
|
| 64 |
--echo Now test binlog expiration at startup... |
| 65 |
--echo Disable the 'immediate expiration' mechanism |
| 66 |
set global debug=''; |
| 67 |
|
| 68 |
--echo Create some binlogs... |
| 69 |
--disable_result_log |
| 70 |
call go_forth_and_make_binlog(40); |
| 71 |
--enable_result_log |
| 72 |
|
| 73 |
#show binary logs; |
| 74 |
|
| 75 |
# Ignore the warning generated by ndbcluster's binlog thread |
| 76 |
# when mysqld is restarted |
| 77 |
--disable_query_log ONCE |
| 78 |
call mtr.add_suppression("mysqld startup An incident event has been written"); |
| 79 |
|
| 80 |
--echo Now restart, should re-pickup the expire-log-days |
| 81 |
--echo debug setting from the config file, and perform |
| 82 |
--echo expire-logs action at restart... |
| 83 |
let $mysqld_name=mysqld.1.1; |
| 84 |
--source include/restart_mysqld.inc |
| 85 |
|
| 86 |
--source include/ndb_not_readonly.inc |
| 87 |
|
| 88 |
#show binary logs; |
| 89 |
|
| 90 |
|
| 91 |
drop procedure go_forth_and_make_binlog; |
| 92 |
drop table tm; |
| 93 |
drop table tn; |