1CALL mtr.add_suppression("The option expire_logs_days cannot be used together*");
2####
3#### 1. When binlog_expire_logs_seconds == 0 and expire_logs_days == 0
4####    no purge should happen
5SET GLOBAL binlog_expire_logs_seconds= 0;
6SET GLOBAL expire_logs_days= 0;
7Warnings:
8Warning	1287	'@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
9CREATE TABLE t1(s LONGBLOB );
10Case:0
11FLUSH LOGS;
12INSERT INTO t1 VALUES('a');
13FLUSH LOGS;
14#### 1. FLUSH LOGS
15FLUSH LOGS;
16RESET MASTER;
17Case:1
18FLUSH LOGS;
19INSERT INTO t1 VALUES('a');
20FLUSH LOGS;
21#### 2. Binlog_size > max_binlog_size
22SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
23INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
24RESET MASTER;
25Case:2
26FLUSH LOGS;
27INSERT INTO t1 VALUES('a');
28FLUSH LOGS;
29#### 3. Server restart
30# restart:--binlog_expire_logs_seconds=0
31RESET MASTER;
32##### Cleanup #####
33SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;;
34DROP TABLE t1;
35RESET MASTER;
36####
37#### 2.1: binlog_expire_logs_seconds > 0 and expire_logs_days == 0
38####
39Testing with smaller values of binlog_expire_logs_seconds
40SET GLOBAL binlog_expire_logs_seconds= 30;
41SET GLOBAL expire_logs_days= 0;
42Warnings:
43Warning	1287	'@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
44FLUSH LOGS;
45FLUSH LOGS;
46FLUSH LOGS;
47RESET MASTER;
48Testing with greater values of binlog_expire_logs_seconds
49SET GLOBAL binlog_expire_logs_seconds= 3600;
50SET GLOBAL expire_logs_days= 0;
51Warnings:
52Warning	1287	'@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
53CREATE TABLE t1(s LONGBLOB );
54Case:0
55FLUSH LOGS;
56INSERT INTO t1 VALUES('a');
57FLUSH LOGS;
58#### 1. FLUSH LOGS
59FLUSH LOGS;
60RESET MASTER;
61Case:1
62FLUSH LOGS;
63INSERT INTO t1 VALUES('a');
64FLUSH LOGS;
65#### 2. Binlog_size > max_binlog_size
66SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
67INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
68RESET MASTER;
69Case:2
70FLUSH LOGS;
71INSERT INTO t1 VALUES('a');
72FLUSH LOGS;
73#### 3. Server restart
74# restart:--binlog_expire_logs_seconds=3600
75RESET MASTER;
76##### Cleanup #####
77SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;;
78DROP TABLE t1;
79RESET MASTER;
80####
81#### 2.3: binlog_expire_logs_seconds == 0 and expire_logs_days > 0
82####
83SET GLOBAL binlog_expire_logs_seconds= 0;
84SET GLOBAL expire_logs_days= 1;
85Warnings:
86Warning	1287	'@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
87CREATE TABLE t1(s LONGBLOB );
88Case:0
89FLUSH LOGS;
90INSERT INTO t1 VALUES('a');
91FLUSH LOGS;
92#### 1. FLUSH LOGS
93FLUSH LOGS;
94RESET MASTER;
95Case:1
96FLUSH LOGS;
97INSERT INTO t1 VALUES('a');
98FLUSH LOGS;
99#### 2. Binlog_size > max_binlog_size
100SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
101INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
102RESET MASTER;
103Case:2
104FLUSH LOGS;
105INSERT INTO t1 VALUES('a');
106FLUSH LOGS;
107#### 3. Server restart
108# restart:--binlog_expire_logs_seconds=86400
109RESET MASTER;
110##### Cleanup #####
111SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;;
112DROP TABLE t1;
113RESET MASTER;
114SET GLOBAL binlog_expire_logs_seconds= 0;
115SET GLOBAL expire_logs_days= 0;
116Warnings:
117Warning	1287	'@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
118