| 1 |
Test binlog purging, especially 'automatic' purging |
| 2 |
Test expire-log-days handling as part of normal operation |
| 3 |
Logs are rotated as part of transaction COMMIT (to avoid |
| 4 |
a transaction being split across 2 files), rotation checks |
| 5 |
expire-logs-days to decide whether to purge, and purging |
| 6 |
calls into the Ndb handler to think about deleting rows |
| 7 |
from ndb_binlog_index. |
| 8 |
The delete from ndb_binlog_index is itself a SQL statement |
| 9 |
executing *during* the COMMIT of some other transaction, |
| 10 |
potentially in some other engine. Don't want to think |
| 11 |
about that too closely |
| 12 |
show variables like 'log_bin'; |
| 13 |
Variable_name Value |
| 14 |
log_bin ON |
| 15 |
use test; |
| 16 |
create table test.tm (b varchar(1000)) engine=myisam; |
| 17 |
create table test.tn (b varchar(1000)) engine=ndb; |
| 18 |
create procedure go_forth_and_make_binlog(loops int) |
| 19 |
begin |
| 20 |
set @x = 0; |
| 21 |
repeat |
| 22 |
insert into test.tm values (repeat('C', 1000)); |
| 23 |
insert into test.tm values (repeat('C', 1000)); |
| 24 |
insert into test.tm values (repeat('C', 1000)); |
| 25 |
insert into test.tm values (repeat('C', 1000)); |
| 26 |
insert into test.tm values (repeat('C', 1000)); |
| 27 |
insert into test.tm values (repeat('C', 1000)); |
| 28 |
insert into test.tm values (repeat('C', 1000)); |
| 29 |
insert into test.tn values (repeat('N', 1000)); |
| 30 |
delete from test.tm; |
| 31 |
delete from test.tn; |
| 32 |
select sleep(0.1); |
| 33 |
set @x = @x + 1; |
| 34 |
until @x = loops |
| 35 |
end repeat; |
| 36 |
end% |
| 37 |
call go_forth_and_make_binlog(40); |
| 38 |
Now test binlog expiration at startup... |
| 39 |
Disable the 'immediate expiration' mechanism |
| 40 |
set global debug=''; |
| 41 |
Create some binlogs... |
| 42 |
call go_forth_and_make_binlog(40); |
| 43 |
Now restart, should re-pickup the expire-log-days |
| 44 |
debug setting from the config file, and perform |
| 45 |
expire-logs action at restart... |
| 46 |
# restart |
| 47 |
drop procedure go_forth_and_make_binlog; |
| 48 |
drop table tm; |
| 49 |
drop table tn; |