1--source include/have_log_bin.inc
2select @@global.binlog_space_limit;
3
4FLUSH LOGS;
5FLUSH LOGS;
6FLUSH LOGS;
7FLUSH LOGS;
8source include/show_binary_logs.inc;
9
10FLUSH LOGS;
11# binary.000001 should be deleted now
12source include/show_binary_logs.inc;
13
14CREATE TABLE `t1` (
15  `v1` int(11) DEFAULT NULL,
16  `v2` int(11) DEFAULT NULL,
17  KEY `v1` (`v1`)
18);
19INSERT INTO t1 VALUES (0,0);
20# binary.000002+binary.000003+binary.000004 should be deleted now
21source include/show_binary_logs.inc;
22
23INSERT INTO t1 VALUES (1,1);
24# binary.000005 should be deleted now
25source include/show_binary_logs.inc;
26
27FLUSH LOGS;
28# binary.000006 should be deleted now
29source include/show_binary_logs.inc;
30
31FLUSH LOGS;
32FLUSH LOGS;
33FLUSH LOGS;
34FLUSH LOGS;
35source include/show_binary_logs.inc;
36
37PURGE BINARY LOGS TO 'binary.000008';
38FLUSH LOGS;
39# only binary.000007 should be deleted now
40source include/show_binary_logs.inc;
41
42INSERT INTO t1 VALUES (2,2);
43# binary.000008 and binary.000009 should be deleted now
44source include/show_binary_logs.inc;
45
46INSERT INTO t1 VALUES (3,3);
47# binary.000010 should be deleted now
48source include/show_binary_logs.inc;
49
50RESET MASTER;
51source include/show_binary_logs.inc;
52
53INSERT INTO t1 VALUES (4,4);
54FLUSH LOGS;
55INSERT INTO t1 VALUES (5,5);
56source include/show_binary_logs.inc;
57
58INSERT INTO t1 VALUES (6,6);
59# binary.000001 should be deleted now
60source include/show_binary_logs.inc;
61
62FLUSH LOGS;
63FLUSH LOGS;
64# binary.000002 should be deleted now
65source include/show_binary_logs.inc;
66
67--disable_warnings
68DROP TABLE IF EXISTS t1;
69--enable_warnings
70
71