| 1 |
--source include/have_debug.inc |
| 2 |
--source include/big_test.inc |
| 3 |
# The test requires a debug build, in order to trigger |
| 4 |
# a purge using innodb_purge_run_now=ON . |
| 5 |
|
| 6 |
--source include/master-slave.inc |
| 7 |
|
| 8 |
--echo # 1: Set replica parameters |
| 9 |
connection slave; |
| 10 |
|
| 11 |
set @orig_max_undo_log_size = @@innodb_max_undo_log_size; |
| 12 |
set @orig_truncate_frequency = @@innodb_purge_rseg_truncate_frequency; |
| 13 |
|
| 14 |
# Trigger truncation of undo log files once they occupy more than 10MB |
| 15 |
# which is the minimum value of innodb_max_undo_log_size |
| 16 |
set global innodb_max_undo_log_size=10485760; |
| 17 |
set global innodb_purge_rseg_truncate_frequency=1; |
| 18 |
set global super_read_only=1; |
| 19 |
|
| 20 |
--echo |
| 21 |
--echo # 2: Preparing database |
| 22 |
connection master; |
| 23 |
|
| 24 |
create table t1(id int); |
| 25 |
|
| 26 |
delimiter $$; |
| 27 |
create procedure insert_data() |
| 28 |
begin |
| 29 |
declare i int; |
| 30 |
set i=1; |
| 31 |
while(i<=500000) do |
| 32 |
insert into t1(id) values(i); |
| 33 |
set i=i+1; |
| 34 |
end while; |
| 35 |
end;$$ |
| 36 |
delimiter ;$$ |
| 37 |
|
| 38 |
begin; |
| 39 |
|
| 40 |
--echo # 3: Inserting data, filling undo logs |
| 41 |
call insert_data(); |
| 42 |
|
| 43 |
--echo # 4: commit, trigger undo log truncation |
| 44 |
commit; |
| 45 |
|
| 46 |
--let $slave_timeout = 3000 |
| 47 |
--source include/sync_slave_sql_with_master.inc |
| 48 |
|
| 49 |
connection slave; |
| 50 |
|
| 51 |
--source include/wait_innodb_all_purged.inc |
| 52 |
|
| 53 |
|
| 54 |
# expecting two undo files, and no undo_*_trunc.log files remaining |
| 55 |
|
| 56 |
select tablespace_name, file_name from information_schema.files |
| 57 |
where file_name like "%undo%"; |
| 58 |
select name, row_format from information_schema.innodb_tablespaces |
| 59 |
where name like '%undo%'; |
| 60 |
|
| 61 |
let $MYSQLD_DATADIR = `select @@datadir`; |
| 62 |
|
| 63 |
--echo # 5: undo files undo_001 and undo_002 are expected to exist, |
| 64 |
--echo # while files undo_001_trunc.log and undo_002_trunc.log are expected to not exist |
| 65 |
list_files $MYSQLD_DATADIR undo*; |
| 66 |
|
| 67 |
set global innodb_max_undo_log_size=@orig_max_undo_log_size; |
| 68 |
set global innodb_purge_rseg_truncate_frequency=@orig_truncate_frequency; |
| 69 |
set global super_read_only = 0; |
| 70 |
set global read_only = 0; |
| 71 |
connection master; |
| 72 |
drop procedure insert_data; |
| 73 |
drop table t1; |
| 74 |
--source include/rpl_end.inc |