Commit 7e1ec155 authored by Sujatha's avatar Sujatha

MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs

Post push fixes.

* Set binlog_expire_logs_seconds max valid value to 8553600
  i.e 99 * 24 * 60 * 60 (99 days)
parent 1b1882c6
......@@ -79,8 +79,8 @@ The following specify which files/extra groups are read (specified before remain
--binlog-expire-logs-seconds=#
If non-zero, binary logs will be purged after
binlog_expire_logs_seconds seconds; It and
expire_logs_days are aliases, such that changes in one
are converted into the other. Possible purges happen at
expire_logs_days are linked, such that changes in one are
converted into the other. Possible purges happen at
startup and at binary log rotation.
--binlog-file-cache-size=#
The size of file cache for the binary log
......@@ -275,7 +275,7 @@ The following specify which files/extra groups are read (specified before remain
--expire-logs-days=#
If non-zero, binary logs will be purged after
expire_logs_days days; It and binlog_expire_logs_seconds
are aliases, such that changes in one are converted into
are linked, such that changes in one are converted into
the other, presentable as a decimal value with 1/1000000
of the day precision; possible purges happen at startup
and at binary log rotation
......
......@@ -136,5 +136,15 @@ SELECT @@expire_logs_days;
SELECT @@binlog_expire_logs_seconds as Expected_1;
Expected_1
1
####
#### 2.5. binlog_expire_logs_seconds = 8553600, testing max value 99days
####
SET GLOBAL binlog_expire_logs_seconds= 8553600;
SELECT @@expire_logs_days;
@@expire_logs_days
99.000000
SELECT @@binlog_expire_logs_seconds as Expected_8553600;
Expected_8553600
8553600
SET GLOBAL binlog_expire_logs_seconds= 0;
SET GLOBAL expire_logs_days= 0.000000;
......@@ -13,6 +13,7 @@
# 2.2. binlog_expire_logs_seconds > 0 and expire_logs_days = 0
# 2.3. binlog_expire_logs_seconds = 0 and expire_logs_days > 0
# 2.4. binlog_expire_logs_seconds = 1, testing smallest value
# 2.5. binlog_expire_logs_seconds = 8553600, testing max value 99days
#
# Additional tests for the boundaries of expire_logs_days already
# exist on the sys_vars.expire_logs_days_basic test case.
......@@ -109,6 +110,13 @@ SET GLOBAL binlog_expire_logs_seconds= 1;
SELECT @@expire_logs_days;
SELECT @@binlog_expire_logs_seconds as Expected_1;
--echo ####
--echo #### 2.5. binlog_expire_logs_seconds = 8553600, testing max value 99days
--echo ####
SET GLOBAL binlog_expire_logs_seconds= 8553600;
SELECT @@expire_logs_days;
SELECT @@binlog_expire_logs_seconds as Expected_8553600;
# reset the variables
--eval SET GLOBAL binlog_expire_logs_seconds= $saved_binlog_expire_logs_seconds
--eval SET GLOBAL expire_logs_days= $saved_expire_logs_days
......@@ -2,7 +2,6 @@ SET @start_value_sec = @@global.binlog_expire_logs_seconds;
SELECT @start_value_sec;
@start_value_sec
0
SET @@global.binlog_expire_logs_seconds = 8734635;
SET @@global.binlog_expire_logs_seconds = DEFAULT;
SELECT @@global.binlog_expire_logs_seconds;
@@global.binlog_expire_logs_seconds
......@@ -49,22 +48,28 @@ Warnings:
Warning 1292 Truncated incorrect binlog_expire_logs_seconds value: '42949672950'
SELECT @@global.binlog_expire_logs_seconds;
@@global.binlog_expire_logs_seconds
4294967295
8553600
SET @@global.binlog_expire_logs_seconds = 8734635;
Warnings:
Warning 1292 Truncated incorrect binlog_expire_logs_seconds value: '8734635'
SELECT @@global.binlog_expire_logs_seconds;
@@global.binlog_expire_logs_seconds
8553600
SET @@global.binlog_expire_logs_seconds = ON;
ERROR 42000: Incorrect argument type to variable 'binlog_expire_logs_seconds'
SELECT @@global.binlog_expire_logs_seconds;
@@global.binlog_expire_logs_seconds
4294967295
8553600
SET @@global.binlog_expire_logs_seconds = 'test';
ERROR 42000: Incorrect argument type to variable 'binlog_expire_logs_seconds'
SELECT @@global.binlog_expire_logs_seconds;
@@global.binlog_expire_logs_seconds
4294967295
8553600
SET @@session.binlog_expire_logs_seconds = 0;
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@binlog_expire_logs_seconds;
@@binlog_expire_logs_seconds
4294967295
8553600
SELECT @@global.binlog_expire_logs_seconds = VARIABLE_VALUE
FROM information_schema.global_variables
WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
......
--- ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded.result 2021-05-10 08:58:14.515886306 +0530
+++ ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.reject 2021-05-10 09:16:56.826971068 +0530
--- ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded.result 2021-05-11 19:44:57.048781628 +0530
+++ ../../mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.reject 2021-05-12 15:26:31.616449925 +0530
@@ -34,7 +34,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_BLOCK_SIZE
......@@ -170,9 +170,9 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are aliases, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_MAX_VALUE 8553600
@@ -397,7 +397,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of file cache for the binary log
......
......@@ -385,9 +385,9 @@ COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME BINLOG_EXPIRE_LOGS_SECONDS
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are aliases, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_MAX_VALUE 8553600
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
......@@ -915,7 +915,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME EXPIRE_LOGS_DAYS
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE DOUBLE
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; It and binlog_expire_logs_seconds are aliases, such that changes in one are converted into the other, presentable as a decimal value with 1/1000000 of the day precision; possible purges happen at startup and at binary log rotation
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; It and binlog_expire_logs_seconds are linked, such that changes in one are converted into the other, presentable as a decimal value with 1/1000000 of the day precision; possible purges happen at startup and at binary log rotation
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 99
NUMERIC_BLOCK_SIZE NULL
......
--- ../../mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result 2021-05-10 08:42:29.501443605 +0530
+++ ../../mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.reject 2021-05-10 09:19:21.925772681 +0530
--- ../../mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result 2021-05-12 15:30:19.783373551 +0530
+++ ../../mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.reject 2021-05-12 15:32:40.170343130 +0530
@@ -34,7 +34,7 @@
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME ARIA_BLOCK_SIZE
......@@ -170,9 +170,9 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are aliases, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_MAX_VALUE 8553600
@@ -397,7 +397,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of file cache for the binary log
......
......@@ -385,9 +385,9 @@ COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME BINLOG_EXPIRE_LOGS_SECONDS
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are aliases, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
VARIABLE_COMMENT If non-zero, binary logs will be purged after binlog_expire_logs_seconds seconds; It and expire_logs_days are linked, such that changes in one are converted into the other. Possible purges happen at startup and at binary log rotation.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_MAX_VALUE 8553600
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
......@@ -935,7 +935,7 @@ COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME EXPIRE_LOGS_DAYS
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE DOUBLE
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; It and binlog_expire_logs_seconds are aliases, such that changes in one are converted into the other, presentable as a decimal value with 1/1000000 of the day precision; possible purges happen at startup and at binary log rotation
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; It and binlog_expire_logs_seconds are linked, such that changes in one are converted into the other, presentable as a decimal value with 1/1000000 of the day precision; possible purges happen at startup and at binary log rotation
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 99
NUMERIC_BLOCK_SIZE NULL
......
......@@ -35,7 +35,6 @@ SELECT @start_value_sec;
# Display the DEFAULT value of binlog_expire_logs_seconds #
########################################################################
SET @@global.binlog_expire_logs_seconds = 8734635;
SET @@global.binlog_expire_logs_seconds = DEFAULT;
SELECT @@global.binlog_expire_logs_seconds;
......@@ -72,6 +71,8 @@ SET @@global.binlog_expire_logs_seconds = -1024;
SELECT @@global.binlog_expire_logs_seconds;
SET @@global.binlog_expire_logs_seconds = 42949672950;
SELECT @@global.binlog_expire_logs_seconds;
SET @@global.binlog_expire_logs_seconds = 8734635;
SELECT @@global.binlog_expire_logs_seconds;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.binlog_expire_logs_seconds = ON;
......
......@@ -1175,7 +1175,7 @@ static Sys_var_on_access_global<Sys_var_double,
Sys_expire_logs_days(
"expire_logs_days",
"If non-zero, binary logs will be purged after expire_logs_days "
"days; It and binlog_expire_logs_seconds are aliases, such that "
"days; It and binlog_expire_logs_seconds are linked, such that "
"changes in one are converted into the other, presentable as a "
"decimal value with 1/1000000 of the day precision; possible "
"purges happen at startup and at binary log rotation",
......@@ -1190,11 +1190,11 @@ Sys_binlog_expire_logs_seconds(
"binlog_expire_logs_seconds",
"If non-zero, binary logs will be purged after "
"binlog_expire_logs_seconds seconds; It and expire_logs_days are "
"aliases, such that changes in one are converted into the other. "
"linked, such that changes in one are converted into the other. "
"Possible purges happen at startup and at binary log rotation.",
GLOBAL_VAR(binlog_expire_logs_seconds),
CMD_LINE(REQUIRED_ARG, OPT_BINLOG_EXPIRE_LOGS_SECONDS),
VALID_RANGE(0, 0xFFFFFFFF), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
VALID_RANGE(0, 8553600), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(copy_to_expire_logs_days));
static Sys_var_mybool Sys_flush(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment