| 1 |
--source include/have_log_bin.inc |
| 2 |
select @@global.max_binlog_total_size; |
| 3 |
select @@global.max_binlog_size; |
| 4 |
|
| 5 |
# Note that this test is only using MyISAM tables. |
| 6 |
# The reason for this is that we do not want to have engine |
| 7 |
# checkpoints in the binary log as it would change the number of |
| 8 |
# bytes in the log, which could cause random rotations. |
| 9 |
|
| 10 |
--echo # |
| 11 |
--echo # MDEV-31404 Implement binlog_space_limit |
| 12 |
--echo # |
| 13 |
|
| 14 |
FLUSH LOGS; |
| 15 |
FLUSH LOGS; |
| 16 |
FLUSH LOGS; |
| 17 |
source include/show_binary_logs.inc; |
| 18 |
show status like "binlog_disk_use"; |
| 19 |
set @@global.slave_connections_needed_for_purge= 0; |
| 20 |
--echo # binary.000001 should be deleted now |
| 21 |
source include/show_binary_logs.inc; |
| 22 |
show status like "binlog_disk_use"; |
| 23 |
|
| 24 |
CREATE TABLE `t1` ( |
| 25 |
`v1` int(11) DEFAULT NULL, |
| 26 |
`v2` varchar(8000) DEFAULT NULL, |
| 27 |
KEY `v1` (`v1`) |
| 28 |
) engine=myisam; |
| 29 |
INSERT INTO t1 VALUES (0,repeat("a",3000)); |
| 30 |
show status like "binlog_disk_use"; |
| 31 |
--echo # First binary should be binary.000004 |
| 32 |
source include/show_binary_logs.inc; |
| 33 |
|
| 34 |
INSERT INTO t1 VALUES (2,repeat("b",10)); |
| 35 |
--echo # First binary should be binary.000004 |
| 36 |
# The reson why we have logs 00004 and 00005 at this point is that we first |
| 37 |
# do a rotate and then try to purge. However as there are still existing |
| 38 |
# xid's pointing to the 00004, we cannot yet purge 000004. |
| 39 |
# After rotate a checkpoint record will be written to 00005 which |
| 40 |
# will release pointers to 00004. On next binary log write or flush |
| 41 |
# the purge will be retried and succeed. |
| 42 |
|
| 43 |
source include/show_binary_logs.inc; |
| 44 |
|
| 45 |
FLUSH LOGS; |
| 46 |
--echo # First binary should be binary.000005 |
| 47 |
source include/show_binary_logs.inc; |
| 48 |
|
| 49 |
FLUSH LOGS; |
| 50 |
FLUSH LOGS; |
| 51 |
FLUSH LOGS; |
| 52 |
FLUSH LOGS; |
| 53 |
source include/show_binary_logs.inc; |
| 54 |
show status like "binlog_disk_use"; |
| 55 |
|
| 56 |
PURGE BINARY LOGS TO 'binary.000009'; |
| 57 |
--echo # First binary should be binary.000009 |
| 58 |
source include/show_binary_logs.inc; |
| 59 |
|
| 60 |
INSERT INTO t1 VALUES (3,repeat("c",4000)); |
| 61 |
--echo # First binary should be binary.000010 |
| 62 |
source include/show_binary_logs.inc; |
| 63 |
|
| 64 |
INSERT INTO t1 VALUES (4,repeat("d",3000)); |
| 65 |
--echo # First binary should be binary.000011 |
| 66 |
source include/show_binary_logs.inc; |
| 67 |
|
| 68 |
RESET MASTER; |
| 69 |
source include/show_binary_logs.inc; |
| 70 |
show status like "binlog_disk_use"; |
| 71 |
|
| 72 |
INSERT INTO t1 VALUES (5,"e"); |
| 73 |
FLUSH LOGS; |
| 74 |
INSERT INTO t1 VALUES (6,repeat("f",3000)); |
| 75 |
source include/show_binary_logs.inc; |
| 76 |
show status like "binlog_disk_use"; |
| 77 |
|
| 78 |
INSERT INTO t1 VALUES (7,repeat("g",3000)); |
| 79 |
--echo # binary.000001 should be deleted now |
| 80 |
source include/show_binary_logs.inc; |
| 81 |
show status like "binlog_disk_use"; |
| 82 |
|
| 83 |
FLUSH LOGS; |
| 84 |
FLUSH LOGS; |
| 85 |
--echo # binary.000002 should be deleted now |
| 86 |
show binary logs; |
| 87 |
show status like "binlog_disk_use"; |
| 88 |
|
| 89 |
--disable_warnings |
| 90 |
DROP TABLE IF EXISTS t1; |
| 91 |
--enable_warnings |
| 92 |
|
| 93 |
set @@global.slave_connections_needed_for_purge= default; |
| 94 |
# End of 11.4 tests |