diff --git a/mysql/help/binlogs.html b/mysql/help/binlogs.html index 265ae6044..73d2adf9e 100644 --- a/mysql/help/binlogs.html +++ b/mysql/help/binlogs.html @@ -8,11 +8,12 @@ point-in-time recovery of backups.
When binary logging is enabled, log files are written under the configured base name and grow as changes are made. To stop them from filling up the disk, a retention period can be set after which old logs are automatically deleted, -or old logs can be deleted immediately using the form at the bottom of the -page.
+or old logs can be deleted immediately on the Delete Logs tab. The +button at the bottom of the page closes the current log and starts a new one, +giving backups and log deletion a clean boundary.
-For any changes on this page to take effect, the MySQL server must be -re-started, either with the Save and Restart MySQL button or using the -buttons on the module's main page.
+Configuration changes only take effect once the MySQL server is re-started, +either with the Save and Restart MySQL button or using the buttons on +the module's main page. Deleting and rotating logs happen immediately.
+ +
A value of 0 disables automatic deletion entirely. Fractions of a +day like 0.5 are supported on MySQL 8 and MariaDB 10.6 or later. +MariaDB always limits retention to 99 days, while MySQL 8 accepts up to +49710 days.
diff --git a/mysql/help/binlogs_maxsize.html b/mysql/help/binlogs_maxsize.html index ab2ec8d55..059462c51 100644 --- a/mysql/help/binlogs_maxsize.html +++ b/mysql/help/binlogs_maxsize.html @@ -3,4 +3,4 @@When a binary log file reaches this size, the server closes it and starts writing a new one. Smaller files make deleting old logs and point-in-time recovery more granular, at the cost of more files. The server accepts sizes -between 4 kB and 1 GB, which is also the default.
+between 4 kB and 1 GB, and defaults to the 1 GB maximum. diff --git a/mysql/mysql-lib.pl b/mysql/mysql-lib.pl index c013a0572..3c29f7420 100755 --- a/mysql/mysql-lib.pl +++ b/mysql/mysql-lib.pl @@ -1288,6 +1288,17 @@ my ($days) = @_; return int($days * 86400 + 0.5); } +# get_binlog_expire_max([variant]) +# Returns the maximum retention in seconds that this or the given database +# variant accepts, which is 99 days on MariaDB but the full 32-bit range +# on MySQL +sub get_binlog_expire_max +{ +my ($variant) = @_; +($variant) = (&get_mysql_variant_cached())[1] if (!$variant); +return $variant eq "mariadb" ? 8553600 : 4294967295; +} + # get_mysql_variant_cached() # Like get_remote_mysql_variant, but falls back to the version detected at # module setup time when the server cannot be queried, such as when it is diff --git a/mysql/save_binlogs.cgi b/mysql/save_binlogs.cgi index 794f37d36..cea2a1703 100755 --- a/mysql/save_binlogs.cgi +++ b/mysql/save_binlogs.cgi @@ -123,11 +123,13 @@ else { &error($text{'binlogs_eexpire'}); my $days = $in{'expire'} + 0; if ($newexpire) { - # The seconds variable is limited to 32 bits + # The seconds variable is limited to 99 days on MariaDB, and + # to 32 bits on MySQL my $secs = &parse_binlog_expire_days($days); - $secs <= 4294967295 || + my $max = &get_binlog_expire_max($variant); + $secs <= $max || &error(&text('binlogs_eexpiremax', - &format_binlog_expire_days(4294967295))); + &format_binlog_expire_days($max))); &save_directive($conf, $mysqld, "expire_logs_days", [ ]); &save_directive($conf, $mysqld, "binlog_expire_logs_seconds", [ $secs ]); diff --git a/t/mysql-lib.t b/t/mysql-lib.t index d77e3544e..025d6bce4 100644 --- a/t/mysql-lib.t +++ b/t/mysql-lib.t @@ -138,4 +138,19 @@ subtest 'binary log retention limit covers the full 32-bit range' => sub { 'whole days below the maximum stay within the limit'); }; +subtest 'retention maximum is variant specific' => sub { + is(main::get_binlog_expire_max('mysql'), 4294967295, + 'MySQL accepts the full 32-bit seconds range'); + is(main::get_binlog_expire_max('mariadb'), 8553600, + 'MariaDB is limited to 99 days of seconds'); + is(main::parse_binlog_expire_days(99), + main::get_binlog_expire_max('mariadb'), + 'exactly 99 days is accepted on MariaDB'); + cmp_ok(main::parse_binlog_expire_days('99.000012'), '>', + main::get_binlog_expire_max('mariadb'), + 'just over 99 days exceeds the MariaDB limit'); + is(main::format_binlog_expire_days(8553600), '99', + 'the MariaDB maximum displays as 99 days'); +}; + done_testing();