| 1 |
CALL 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 |
| 5 |
SET GLOBAL binlog_expire_logs_seconds= 0; |
| 6 |
SET GLOBAL expire_logs_days= 0; |
| 7 |
Warnings: |
| 8 |
Warning 1287 '@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead. |
| 9 |
CREATE TABLE t1(s LONGBLOB ); |
| 10 |
Case:0 |
| 11 |
FLUSH LOGS; |
| 12 |
INSERT INTO t1 VALUES('a'); |
| 13 |
FLUSH LOGS; |
| 14 |
#### 1. FLUSH LOGS |
| 15 |
FLUSH LOGS; |
| 16 |
RESET MASTER; |
| 17 |
Case:1 |
| 18 |
FLUSH LOGS; |
| 19 |
INSERT INTO t1 VALUES('a'); |
| 20 |
FLUSH LOGS; |
| 21 |
#### 2. Binlog_size > max_binlog_size |
| 22 |
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096; |
| 23 |
INSERT INTO t1 (s) VALUES (REPEAT('s',50000)); |
| 24 |
RESET MASTER; |
| 25 |
Case:2 |
| 26 |
FLUSH LOGS; |
| 27 |
INSERT INTO t1 VALUES('a'); |
| 28 |
FLUSH LOGS; |
| 29 |
#### 3. Server restart |
| 30 |
# restart:--binlog_expire_logs_seconds=0 |
| 31 |
RESET MASTER; |
| 32 |
##### Cleanup ##### |
| 33 |
SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;; |
| 34 |
DROP TABLE t1; |
| 35 |
RESET MASTER; |
| 36 |
#### |
| 37 |
#### 2.1: binlog_expire_logs_seconds > 0 and expire_logs_days == 0 |
| 38 |
#### |
| 39 |
Testing with smaller values of binlog_expire_logs_seconds |
| 40 |
SET GLOBAL binlog_expire_logs_seconds= 30; |
| 41 |
SET GLOBAL expire_logs_days= 0; |
| 42 |
Warnings: |
| 43 |
Warning 1287 '@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead. |
| 44 |
FLUSH LOGS; |
| 45 |
FLUSH LOGS; |
| 46 |
FLUSH LOGS; |
| 47 |
RESET MASTER; |
| 48 |
Testing with greater values of binlog_expire_logs_seconds |
| 49 |
SET GLOBAL binlog_expire_logs_seconds= 3600; |
| 50 |
SET GLOBAL expire_logs_days= 0; |
| 51 |
Warnings: |
| 52 |
Warning 1287 '@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead. |
| 53 |
CREATE TABLE t1(s LONGBLOB ); |
| 54 |
Case:0 |
| 55 |
FLUSH LOGS; |
| 56 |
INSERT INTO t1 VALUES('a'); |
| 57 |
FLUSH LOGS; |
| 58 |
#### 1. FLUSH LOGS |
| 59 |
FLUSH LOGS; |
| 60 |
RESET MASTER; |
| 61 |
Case:1 |
| 62 |
FLUSH LOGS; |
| 63 |
INSERT INTO t1 VALUES('a'); |
| 64 |
FLUSH LOGS; |
| 65 |
#### 2. Binlog_size > max_binlog_size |
| 66 |
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096; |
| 67 |
INSERT INTO t1 (s) VALUES (REPEAT('s',50000)); |
| 68 |
RESET MASTER; |
| 69 |
Case:2 |
| 70 |
FLUSH LOGS; |
| 71 |
INSERT INTO t1 VALUES('a'); |
| 72 |
FLUSH LOGS; |
| 73 |
#### 3. Server restart |
| 74 |
# restart:--binlog_expire_logs_seconds=3600 |
| 75 |
RESET MASTER; |
| 76 |
##### Cleanup ##### |
| 77 |
SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;; |
| 78 |
DROP TABLE t1; |
| 79 |
RESET MASTER; |
| 80 |
#### |
| 81 |
#### 2.3: binlog_expire_logs_seconds == 0 and expire_logs_days > 0 |
| 82 |
#### |
| 83 |
SET GLOBAL binlog_expire_logs_seconds= 0; |
| 84 |
SET GLOBAL expire_logs_days= 1; |
| 85 |
Warnings: |
| 86 |
Warning 1287 '@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead. |
| 87 |
CREATE TABLE t1(s LONGBLOB ); |
| 88 |
Case:0 |
| 89 |
FLUSH LOGS; |
| 90 |
INSERT INTO t1 VALUES('a'); |
| 91 |
FLUSH LOGS; |
| 92 |
#### 1. FLUSH LOGS |
| 93 |
FLUSH LOGS; |
| 94 |
RESET MASTER; |
| 95 |
Case:1 |
| 96 |
FLUSH LOGS; |
| 97 |
INSERT INTO t1 VALUES('a'); |
| 98 |
FLUSH LOGS; |
| 99 |
#### 2. Binlog_size > max_binlog_size |
| 100 |
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096; |
| 101 |
INSERT INTO t1 (s) VALUES (REPEAT('s',50000)); |
| 102 |
RESET MASTER; |
| 103 |
Case:2 |
| 104 |
FLUSH LOGS; |
| 105 |
INSERT INTO t1 VALUES('a'); |
| 106 |
FLUSH LOGS; |
| 107 |
#### 3. Server restart |
| 108 |
# restart:--binlog_expire_logs_seconds=86400 |
| 109 |
RESET MASTER; |
| 110 |
##### Cleanup ##### |
| 111 |
SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;; |
| 112 |
DROP TABLE t1; |
| 113 |
RESET MASTER; |
| 114 |
RESET MASTER; |
| 115 |
SET GLOBAL binlog_expire_logs_seconds=2147483648; |
| 116 |
FLUSH LOGS; |
| 117 |
RESET MASTER; |
| 118 |
SET GLOBAL binlog_expire_logs_seconds=4294967295; |
| 119 |
FLUSH LOGS; |
| 120 |
RESET MASTER; |
| 121 |
### Code coverage for WL#14930 boundary conditions |
| 122 |
### Expiration time < 0 |
| 123 |
### Test case: binlog_expire_logs_seconds set to current time |
| 124 |
SET GLOBAL binlog_expire_logs_seconds= CURRENT_TIME; |
| 125 |
FLUSH LOGS; |
| 126 |
RESET MASTER; |
| 127 |
### Test case: binlog_expire_logs_seconds set to current_time + 2^31 |
| 128 |
SET GLOBAL binlog_expire_logs_seconds= 2<<31+ CURRENT_TIME; |
| 129 |
FLUSH LOGS; |
| 130 |
RESET MASTER; |
| 131 |
### Test case: binlog_expire_logs_seconds set to current_time + 2^30 |
| 132 |
SET GLOBAL binlog_expire_logs_seconds= 2<<30+ CURRENT_TIME; |
| 133 |
FLUSH LOGS; |
| 134 |
RESET MASTER; |
| 135 |
SET GLOBAL binlog_expire_logs_seconds= 0; |
| 136 |
SET GLOBAL expire_logs_days= 0; |
| 137 |
Warnings: |
| 138 |
Warning 1287 '@@expire_logs_days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead. |