mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs
Part2: Test scripts
This commit is contained in:
@ -94,12 +94,17 @@ if ($assert_match != '')
|
||||
my $assert_only_after= $ENV{'_AG_ASSERT_ONLY_AFTER'};
|
||||
my $out= $ENV{'_AG_OUT'};
|
||||
|
||||
if (!defined($assert_count)) {
|
||||
$assert_count = '';
|
||||
}
|
||||
|
||||
my $result= '';
|
||||
my $count= 0;
|
||||
open(FILE, "$file") or die("Error $? opening $file: $!\n");
|
||||
while (<FILE>) {
|
||||
my $line = $_;
|
||||
if ($assert_only_after && $line =~ /$assert_only_after/) {
|
||||
if (($line =~ /^CURRENT_TEST: /) ||
|
||||
($assert_only_after && $line =~ /$assert_only_after/)) {
|
||||
$result = "";
|
||||
$count = 0;
|
||||
}
|
||||
@ -129,11 +134,8 @@ EOF
|
||||
|
||||
--let $_ag_outcome= `SELECT LOAD_FILE('$_AG_OUT')`
|
||||
if ($_ag_outcome != 'assert_grep.inc ok')
|
||||
{
|
||||
if ($rpl_server_count != '')
|
||||
{
|
||||
--source include/show_rpl_debug_info.inc
|
||||
}
|
||||
--echo include/assert_grep.inc failed!
|
||||
--echo assert_text: '$assert_text'
|
||||
--echo assert_file: '$assert_file'
|
||||
@ -152,6 +154,6 @@ if ($_ag_outcome != 'assert_grep.inc ok')
|
||||
--die assert_grep.inc failed.
|
||||
}
|
||||
|
||||
|
||||
--remove_file $_AG_OUT
|
||||
--let $include_filename= include/assert_grep.inc [$assert_text]
|
||||
--source include/end_include_file.inc
|
||||
|
@ -42,6 +42,7 @@
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
--enable_warnings
|
||||
--enable_connect_log
|
||||
--disable_abort_on_error
|
||||
--horizontal_results
|
||||
|
||||
@ -49,6 +50,10 @@
|
||||
--let $_rpl_old_con= $CURRENT_CONNECTION
|
||||
--let $_rpl_is_first_server= 1
|
||||
--let $_rpl_server= $rpl_server_count
|
||||
if ($_rpl_server == '')
|
||||
{
|
||||
--let $_rpl_server= 0
|
||||
}
|
||||
--inc $_rpl_server
|
||||
|
||||
|
||||
|
@ -76,6 +76,12 @@ The following specify which files/extra groups are read (specified before remain
|
||||
--binlog-do-db=name Tells the master it should log updates for the specified
|
||||
database, and exclude all others not explicitly
|
||||
mentioned.
|
||||
--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
|
||||
startup and at binary log rotation.
|
||||
--binlog-file-cache-size=#
|
||||
The size of file cache for the binary log
|
||||
--binlog-format=name
|
||||
@ -268,7 +274,10 @@ The following specify which files/extra groups are read (specified before remain
|
||||
constant optimization
|
||||
--expire-logs-days=#
|
||||
If non-zero, binary logs will be purged after
|
||||
expire_logs_days days; possible purges happen at startup
|
||||
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
|
||||
--explicit-defaults-for-timestamp
|
||||
This option causes CREATE TABLE to create all TIMESTAMP
|
||||
@ -1469,6 +1478,7 @@ binlog-checksum CRC32
|
||||
binlog-commit-wait-count 0
|
||||
binlog-commit-wait-usec 100000
|
||||
binlog-direct-non-transactional-updates FALSE
|
||||
binlog-expire-logs-seconds 0
|
||||
binlog-file-cache-size 16384
|
||||
binlog-format MIXED
|
||||
binlog-optimize-thread-scheduling TRUE
|
||||
|
@ -1390,7 +1390,7 @@ Warning 1292 Truncated incorrect expire_logs_days value: '-1'
|
||||
needs to've been adjusted (0)
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
0
|
||||
0.000000
|
||||
SET GLOBAL expire_logs_days = 11;
|
||||
SET @old_mode=@@sql_mode;
|
||||
SET SESSION sql_mode = 'TRADITIONAL';
|
||||
@ -1399,7 +1399,7 @@ ERROR 42000: Variable 'expire_logs_days' can't be set to the value of '100'
|
||||
needs to be unchanged (11)
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
11
|
||||
11.000000
|
||||
SET SESSION sql_mode = @old_mode;
|
||||
SET GLOBAL expire_logs_days = 100;
|
||||
Warnings:
|
||||
@ -1407,13 +1407,13 @@ Warning 1292 Truncated incorrect expire_logs_days value: '100'
|
||||
needs to've been adjusted (99)
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET GLOBAL expire_logs_days = 11;
|
||||
SET GLOBAL expire_logs_days = 99;
|
||||
needs to pass with no warnings (99)
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET GLOBAL expire_logs_days = @old_eld;
|
||||
SET GLOBAL auto_increment_offset=-1;
|
||||
Warnings:
|
||||
|
109
mysql-test/suite/binlog/include/binlog_expire_logs_seconds.inc
Normal file
109
mysql-test/suite/binlog/include/binlog_expire_logs_seconds.inc
Normal file
@ -0,0 +1,109 @@
|
||||
#
|
||||
# WL#9237: Add a new variable binlog_expire_logs_seconds
|
||||
|
||||
# Here we will test purging of binary logs when either one or both of these variables are set
|
||||
# - binlog_expire_logs_seconds
|
||||
# - expire_logs_days
|
||||
|
||||
# The three scenarios being tested for are:
|
||||
# 1. FLUSH LOGS
|
||||
# 2. Rotation of logs because of binlog growing bigger than max_binlog_size
|
||||
# 3. Server restart
|
||||
#
|
||||
# Usuage: --let $binlog_expire_logs_seconds=
|
||||
# --let $expire_logs_days=
|
||||
#
|
||||
# --source suite/binlog/include/binlog_expire_logs_seconds.inc
|
||||
|
||||
--let $expire_logs_seconds= `SELECT @@global.binlog_expire_logs_seconds`
|
||||
|
||||
CREATE TABLE t1(s LONGBLOB );
|
||||
|
||||
--let $max_binlog_size_save= `SELECT @@GLOBAL.MAX_BINLOG_SIZE`
|
||||
|
||||
--let $case= 0
|
||||
|
||||
while ($case < 3)
|
||||
{
|
||||
--echo Case:$case
|
||||
--let $first_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
|
||||
# rotates the log, thence the first log will be closed, and depending upon
|
||||
# the expire time the purge will/will not happen.
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
INSERT INTO t1 VALUES('a');
|
||||
|
||||
--let $second_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
|
||||
FLUSH LOGS;
|
||||
|
||||
|
||||
# This is done to avoid time out in cases where the expire time is more.
|
||||
# What we do is in those cases modify the timestamp of the oldest log file
|
||||
# to be the same as expire time so when we execute the next flush log command
|
||||
# the oldest log will be purged.
|
||||
|
||||
# Only change the timestamp of binlog file when the expire_logs_seconds which is the total
|
||||
# time for expiring log is greater than 30 seconds
|
||||
|
||||
if (`SELECT $expire_logs_seconds > 30`)
|
||||
{
|
||||
--let _EXPIRE_TIME= `SELECT $expire_logs_seconds + 60`
|
||||
--let _FIRST_BINLOG_FILE= $MYSQLD_DATADIR/$first_binlog_file
|
||||
--perl
|
||||
use strict;
|
||||
use warnings;
|
||||
my $expire_time = $ENV{'_EXPIRE_TIME'};
|
||||
my $first_binlog_file = $ENV{'_FIRST_BINLOG_FILE'};
|
||||
my $epoch = (stat($first_binlog_file))[9];
|
||||
my $mtime = $epoch - $expire_time;
|
||||
utime $mtime, $mtime, $first_binlog_file;
|
||||
EOF
|
||||
}
|
||||
|
||||
# Checking this ensures that nothing is purged so far.
|
||||
--file_exists $MYSQLD_DATADIR/$first_binlog_file
|
||||
|
||||
if ($case == 0)
|
||||
{
|
||||
--echo #### 1. FLUSH LOGS
|
||||
|
||||
FLUSH LOGS;
|
||||
}
|
||||
if ($case == 1)
|
||||
{
|
||||
--echo #### 2. Binlog_size > max_binlog_size
|
||||
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
|
||||
|
||||
INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
|
||||
}
|
||||
if ($case == 2)
|
||||
{
|
||||
--echo #### 3. Server restart
|
||||
|
||||
--let $restart_parameters=--binlog_expire_logs_seconds=$expire_logs_seconds
|
||||
--source include/restart_mysqld.inc
|
||||
}
|
||||
|
||||
if (`SELECT $expire_logs_seconds != 0`)
|
||||
{
|
||||
--error 1
|
||||
--file_exists $MYSQLD_DATADIR/$first_binlog_file
|
||||
}
|
||||
if ($expire_logs_seconds == 0)
|
||||
{
|
||||
--file_exists $MYSQLD_DATADIR/$first_binlog_file
|
||||
}
|
||||
--file_exists $MYSQLD_DATADIR/$second_binlog_file
|
||||
|
||||
--inc $case
|
||||
RESET MASTER;
|
||||
}
|
||||
--echo ##### Cleanup #####
|
||||
--eval SET @@GLOBAL.MAX_BINLOG_SIZE= $max_binlog_size_save;
|
||||
DROP TABLE t1;
|
||||
RESET MASTER;
|
||||
|
103
mysql-test/suite/binlog/include/binlog_expire_warnings.inc
Normal file
103
mysql-test/suite/binlog/include/binlog_expire_warnings.inc
Normal file
@ -0,0 +1,103 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test one scenario using a combination of --expire-logs-days and
|
||||
# --binlog-expire-logs-seconds. Verify that there are/aren't warnings
|
||||
# as expected, and verify that the values of the global variables are
|
||||
# as expected.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# --let $ofile = FILE
|
||||
# --let $options = SERVER_OPTIONS
|
||||
# --let $days = VALUE
|
||||
# --let $seconds = VALUE
|
||||
# --let $expect_binlog_off_days_and_seconds_warning = [0|1]
|
||||
# --let $expect_seconds = VALUE
|
||||
# --let $option_invoke_order = [days_then_seconds|seconds_then_days]
|
||||
# --let $expect_days = VALUE
|
||||
# --source include/binlog_expire_warnings.inc
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# $ofile
|
||||
# Temporary file to use for the error log.
|
||||
#
|
||||
# $options
|
||||
# Any additional options passed to mysqld during server start.
|
||||
#
|
||||
# $days
|
||||
# The value to set for --expire-logs-days
|
||||
#
|
||||
# $seconds
|
||||
# The value to set for --binlog-expire-logs-seconds
|
||||
#
|
||||
# $option_invoke_order
|
||||
# In which order options --expire-logs-days and
|
||||
# --binlog-expire-logs-seconds should be set.
|
||||
# values are: days_then_seconds, seconds_then_days
|
||||
#
|
||||
# $expect_binlog_off_days_and_seconds_warning
|
||||
# If zero, assert that there is no warning due to using
|
||||
# --expire_logs_days or --binlog_expire_logs_seconds binlog disabled.
|
||||
# If nonzero, assert that there is a warning due to using
|
||||
# --expire_logs_days or --binlog_expire_logs_seconds binlog disabled.
|
||||
#
|
||||
# $expect_days
|
||||
# Assert that @@global.expire_logs_days has this value.
|
||||
#
|
||||
# $expect_seconds
|
||||
# Assert that @@global.binlog_expire_logs_seconds has this value.
|
||||
|
||||
|
||||
--let $restart_parameters = --log-error=$ofile $options
|
||||
if ($option_invoke_order == 'days_then_seconds')
|
||||
{
|
||||
if ($days != '') {
|
||||
--let $restart_parameters = $restart_parameters --expire_logs_days=$days
|
||||
}
|
||||
if ($seconds != '') {
|
||||
--let $restart_parameters = $restart_parameters --binlog-expire-logs-seconds=$seconds
|
||||
}
|
||||
}
|
||||
|
||||
if ($option_invoke_order == 'seconds_then_days')
|
||||
{
|
||||
if ($seconds != '') {
|
||||
--let $restart_parameters = $restart_parameters --binlog-expire-logs-seconds=$seconds
|
||||
}
|
||||
if ($days != '') {
|
||||
--let $restart_parameters = $restart_parameters --expire_logs_days=$days
|
||||
}
|
||||
}
|
||||
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
# For all the assert_grep.inc
|
||||
--let $extra_debug_eval = LOAD_FILE("$ofile")
|
||||
|
||||
if (!$expect_binlog_off_days_and_seconds_warning) {
|
||||
--let $assert_text = There shall be no binlog_off+seconds warning
|
||||
--let $assert_count = 0
|
||||
}
|
||||
|
||||
if ($expect_binlog_off_days_and_seconds_warning) {
|
||||
--let $assert_text = There shall be a binlog_off+seconds warning
|
||||
--let $assert_count = 1
|
||||
}
|
||||
|
||||
--let $assert_file = $ofile
|
||||
--let $assert_select = You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
|
||||
--let $assert_only_after = Shutdown complete
|
||||
--source include/assert_grep.inc
|
||||
|
||||
# For all the assert.inc
|
||||
--let $extra_debug_eval = CONCAT("days: ", @@global.expire_logs_days, " seconds: ", @@global.binlog_expire_logs_seconds)
|
||||
|
||||
--let $assert_text = binlog_expire_logs_seconds shall be $expect_seconds
|
||||
--let $assert_cond = @@global.binlog_expire_logs_seconds = $expect_seconds
|
||||
--source include/assert.inc
|
||||
|
||||
--let $assert_text = expire_logs_days shall be $expect_days
|
||||
--let $assert_cond = @@global.expire_logs_days = $expect_days
|
||||
--source include/assert.inc
|
140
mysql-test/suite/binlog/r/binlog_expire_logs_seconds.result
Normal file
140
mysql-test/suite/binlog/r/binlog_expire_logs_seconds.result
Normal file
@ -0,0 +1,140 @@
|
||||
####
|
||||
#### 1. When binlog_expire_logs_seconds == 0 and expire_logs_days == 0
|
||||
#### no purge should happen
|
||||
SET GLOBAL binlog_expire_logs_seconds= 0;
|
||||
SET GLOBAL expire_logs_days= 0;
|
||||
CREATE TABLE t1(s LONGBLOB );
|
||||
Case:0
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 1. FLUSH LOGS
|
||||
FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
Case:1
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 2. Binlog_size > max_binlog_size
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
|
||||
INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
|
||||
RESET MASTER;
|
||||
Case:2
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 3. Server restart
|
||||
# restart: --binlog_expire_logs_seconds=0
|
||||
RESET MASTER;
|
||||
##### Cleanup #####
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;;
|
||||
DROP TABLE t1;
|
||||
RESET MASTER;
|
||||
####
|
||||
#### 2.1: binlog_expire_logs_seconds > 0 and expire_logs_days > 0
|
||||
#### expire_logs_days=1.5 and binlog_expire_logs_seconds=86400
|
||||
#### Since binlog_expire_logs_seconds is set later
|
||||
#### expire_logs_days value will be overridden should be
|
||||
#### '0.000347222'
|
||||
####
|
||||
Testing with smaller values of binlog_expire_logs_seconds
|
||||
SET GLOBAL expire_logs_days= 1.5;
|
||||
SET GLOBAL binlog_expire_logs_seconds= 30 ;
|
||||
SELECT @@expire_logs_days as 'Expected_0.000347222';
|
||||
Expected_0.000347222
|
||||
0.000347
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_30;
|
||||
Expected_30
|
||||
30
|
||||
FLUSH LOGS;
|
||||
FLUSH LOGS;
|
||||
FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
####
|
||||
#### 2.2: binlog_expire_logs_seconds = 43200 and expire_logs_days = 0
|
||||
####
|
||||
SET GLOBAL expire_logs_days=0;
|
||||
SET GLOBAL binlog_expire_logs_seconds=43200;
|
||||
SELECT @@expire_logs_days as 'Expected_0.5';
|
||||
Expected_0.5
|
||||
0.500000
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_43200;
|
||||
Expected_43200
|
||||
43200
|
||||
CREATE TABLE t1(s LONGBLOB );
|
||||
Case:0
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 1. FLUSH LOGS
|
||||
FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
Case:1
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 2. Binlog_size > max_binlog_size
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
|
||||
INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
|
||||
RESET MASTER;
|
||||
Case:2
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 3. Server restart
|
||||
# restart: --binlog_expire_logs_seconds=43200
|
||||
RESET MASTER;
|
||||
##### Cleanup #####
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;;
|
||||
DROP TABLE t1;
|
||||
RESET MASTER;
|
||||
####
|
||||
#### 2.3: binlog_expire_logs_seconds == 0 and expire_logs_days > 0
|
||||
####
|
||||
SET GLOBAL binlog_expire_logs_seconds= 0;
|
||||
SET GLOBAL expire_logs_days= 1;
|
||||
SELECT @@expire_logs_days as Expected_1;
|
||||
Expected_1
|
||||
1.000000
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_86400;
|
||||
Expected_86400
|
||||
86400
|
||||
CREATE TABLE t1(s LONGBLOB );
|
||||
Case:0
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 1. FLUSH LOGS
|
||||
FLUSH LOGS;
|
||||
RESET MASTER;
|
||||
Case:1
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 2. Binlog_size > max_binlog_size
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 4096;
|
||||
INSERT INTO t1 (s) VALUES (REPEAT('s',50000));
|
||||
RESET MASTER;
|
||||
Case:2
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t1 VALUES('a');
|
||||
FLUSH LOGS;
|
||||
#### 3. Server restart
|
||||
# restart: --binlog_expire_logs_seconds=86400
|
||||
RESET MASTER;
|
||||
##### Cleanup #####
|
||||
SET @@GLOBAL.MAX_BINLOG_SIZE= 1073741824;;
|
||||
DROP TABLE t1;
|
||||
RESET MASTER;
|
||||
####
|
||||
#### 2.4: binlog_expire_logs_seconds = 1
|
||||
####
|
||||
SET GLOBAL binlog_expire_logs_seconds= 1;
|
||||
SELECT @@expire_logs_days;
|
||||
@@expire_logs_days
|
||||
0.000012
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_1;
|
||||
Expected_1
|
||||
1
|
||||
SET GLOBAL binlog_expire_logs_seconds= 0;
|
||||
SET GLOBAL expire_logs_days= 0.000000;
|
134
mysql-test/suite/binlog/r/binlog_expire_warnings.result
Normal file
134
mysql-test/suite/binlog/r/binlog_expire_warnings.result
Normal file
@ -0,0 +1,134 @@
|
||||
#### Binary log ENABLED ####
|
||||
==== Don't set any option ====
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
==== Set one option to zero ====
|
||||
---- days=0 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --expire_logs_days=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
---- seconds=0 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --binlog-expire-logs-seconds=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
==== Set one option to non-zero ====
|
||||
---- days=2 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --expire_logs_days=2
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 172800]
|
||||
include/assert.inc [expire_logs_days shall be 2]
|
||||
---- seconds=86400 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --binlog-expire-logs-seconds=86400
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
==== Set both options to zero ====
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --expire_logs_days=0 --binlog-expire-logs-seconds=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
==== Set both options: one to zero and one to non-zero ====
|
||||
---- days=1 seconds=0 ----
|
||||
---- The later seconds=0 will override days.
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --expire_logs_days=1 --binlog-expire-logs-seconds=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
---- seconds=0 days=1 ----
|
||||
---- The later days=1 will override seconds.
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --binlog-expire-logs-seconds=0 --expire_logs_days=1
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
---- days=0 seconds=86400 ----
|
||||
---- The later seconds=86400 will override days.
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --expire_logs_days=0 --binlog-expire-logs-seconds=86400
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
==== Set both options to non-zero ====
|
||||
---- days=1 and seconds=172800 ----
|
||||
---- Since binlog_expire_logs_seconds is set later expire_log_days
|
||||
---- becomes 2
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --expire_logs_days=1 --binlog-expire-logs-seconds=172800
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 172800]
|
||||
include/assert.inc [expire_logs_days shall be 2]
|
||||
---- days=1 and seconds=172800 ----
|
||||
---- Since expire_logs_days is set later binlog_expire_logs_seconds
|
||||
---- becomes 86400
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --binlog-expire-logs-seconds=172800 --expire_logs_days=1
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
#### Binary log DISABLED ####
|
||||
==== Don't set any option ====
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
==== Set one option to zero ====
|
||||
---- days=0 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --expire_logs_days=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
---- seconds=0 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --binlog-expire-logs-seconds=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
==== Set one option to non-zero ====
|
||||
---- days=2 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --expire_logs_days=2
|
||||
include/assert_grep.inc [There shall be a binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 172800]
|
||||
include/assert.inc [expire_logs_days shall be 2]
|
||||
---- seconds=86400 ----
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --binlog-expire-logs-seconds=86400
|
||||
include/assert_grep.inc [There shall be a binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
==== Set both options to zero ====
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --expire_logs_days=0 --binlog-expire-logs-seconds=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
==== Set both options: one to zero and one to non-zero ====
|
||||
---- days=1 seconds=0 ----
|
||||
---- The later seconds=0 will override days.
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --expire_logs_days=1 --binlog-expire-logs-seconds=0
|
||||
include/assert_grep.inc [There shall be no binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 0]
|
||||
include/assert.inc [expire_logs_days shall be 0]
|
||||
---- seconds=0 days=1 ----
|
||||
---- The later days=1 will override seconds.
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --binlog-expire-logs-seconds=0 --expire_logs_days=1
|
||||
include/assert_grep.inc [There shall be a binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
---- days=0 seconds=86400 ----
|
||||
---- The later seconds=86400 will override days.
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --expire_logs_days=0 --binlog-expire-logs-seconds=86400
|
||||
include/assert_grep.inc [There shall be a binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
||||
==== Set both options to non-zero ====
|
||||
---- days=1 and seconds=172800 ----
|
||||
---- Since binlog_expire_logs_seconds is set later expire_log_days
|
||||
---- becomes 2
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --expire_logs_days=1 --binlog-expire-logs-seconds=172800
|
||||
include/assert_grep.inc [There shall be a binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 172800]
|
||||
include/assert.inc [expire_logs_days shall be 2]
|
||||
---- days=1 and seconds=172800 ----
|
||||
---- Since expire_logs_days is set later binlog_expire_logs_seconds
|
||||
---- becomes 86400
|
||||
# restart: --log-error=MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err --skip-log-bin --binlog-expire-logs-seconds=172800 --expire_logs_days=1
|
||||
include/assert_grep.inc [There shall be a binlog_off+seconds warning]
|
||||
include/assert.inc [binlog_expire_logs_seconds shall be 86400]
|
||||
include/assert.inc [expire_logs_days shall be 1]
|
114
mysql-test/suite/binlog/t/binlog_expire_logs_seconds.test
Normal file
114
mysql-test/suite/binlog/t/binlog_expire_logs_seconds.test
Normal file
@ -0,0 +1,114 @@
|
||||
#
|
||||
# WL#9236: Add a new variable binlog_expire_logs_seconds
|
||||
#
|
||||
# ==== Purpose ====
|
||||
# The test case test the following:
|
||||
#
|
||||
# 1. If binlog_expire_logs_seconds = 0 and expire_logs_days = 0, no purge happens.
|
||||
#
|
||||
# 2. In all the below listed cases it purges the binary logs older than the timeout
|
||||
# and keeps the binary logs newer than the timeout.
|
||||
#
|
||||
# 2.1. binlog_expire_logs_seconds > 0 and expire_logs_days > 0
|
||||
# 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
|
||||
#
|
||||
# Additional tests for the boundaries of expire_logs_days already
|
||||
# exist on the sys_vars.expire_logs_days_basic test case.
|
||||
|
||||
# Test in this file is binlog format agnostic, thus no need
|
||||
# to rerun it for every format.
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/not_windows.inc
|
||||
|
||||
--let $saved_expire_logs_days= `SELECT @@GLOBAL.expire_logs_days`
|
||||
--let $saved_binlog_expire_logs_seconds= `SELECT @@GLOBAL.binlog_expire_logs_seconds`
|
||||
# Set the datadir
|
||||
--let $MYSQLD_DATADIR= `SELECT @@datadir`
|
||||
|
||||
--echo ####
|
||||
--echo #### 1. When binlog_expire_logs_seconds == 0 and expire_logs_days == 0
|
||||
--echo #### no purge should happen
|
||||
|
||||
SET GLOBAL binlog_expire_logs_seconds= 0;
|
||||
SET GLOBAL expire_logs_days= 0;
|
||||
|
||||
# This will test the expire period for three scenarios, described in the .inc file.
|
||||
--source suite/binlog/include/binlog_expire_logs_seconds.inc
|
||||
|
||||
--echo ####
|
||||
--echo #### 2.1: binlog_expire_logs_seconds > 0 and expire_logs_days > 0
|
||||
--echo #### expire_logs_days=1.5 and binlog_expire_logs_seconds=86400
|
||||
--echo #### Since binlog_expire_logs_seconds is set later
|
||||
--echo #### expire_logs_days value will be overridden should be
|
||||
--echo #### '0.000347222'
|
||||
--echo ####
|
||||
|
||||
# Here we will test both with smaller values and larger values
|
||||
|
||||
--echo Testing with smaller values of binlog_expire_logs_seconds
|
||||
|
||||
SET GLOBAL expire_logs_days= 1.5;
|
||||
SET GLOBAL binlog_expire_logs_seconds= 30 ;
|
||||
SELECT @@expire_logs_days as 'Expected_0.000347222';
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_30;
|
||||
|
||||
--let $expire_logs_seconds= `SELECT @@global.binlog_expire_logs_seconds`
|
||||
|
||||
--let $first_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
|
||||
--sleep $expire_logs_seconds
|
||||
|
||||
--let $second_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
||||
FLUSH LOGS;
|
||||
|
||||
# The sleep is in two parts to ensure a time gap between first_binlog_file
|
||||
# and second_binlog_file, by doing that we can check that one is purged and
|
||||
# another isn't.
|
||||
# sleep for n seconds here, n < $expire_logs_seconds
|
||||
--sleep 3
|
||||
FLUSH LOGS;
|
||||
|
||||
--error 1
|
||||
--file_exists $MYSQLD_DATADIR/$first_binlog_file
|
||||
|
||||
--file_exists $MYSQLD_DATADIR/$second_binlog_file
|
||||
|
||||
RESET MASTER;
|
||||
--echo ####
|
||||
--echo #### 2.2: binlog_expire_logs_seconds = 43200 and expire_logs_days = 0
|
||||
--echo ####
|
||||
|
||||
SET GLOBAL expire_logs_days=0;
|
||||
SET GLOBAL binlog_expire_logs_seconds=43200;
|
||||
SELECT @@expire_logs_days as 'Expected_0.5';
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_43200;
|
||||
|
||||
# This will test the expire period for three scenarios, described in the .inc file.
|
||||
|
||||
--source suite/binlog/include/binlog_expire_logs_seconds.inc
|
||||
|
||||
--echo ####
|
||||
--echo #### 2.3: binlog_expire_logs_seconds == 0 and expire_logs_days > 0
|
||||
--echo ####
|
||||
|
||||
SET GLOBAL binlog_expire_logs_seconds= 0;
|
||||
SET GLOBAL expire_logs_days= 1;
|
||||
SELECT @@expire_logs_days as Expected_1;
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_86400;
|
||||
|
||||
# This will test the expire period for three scenarios, described in the .inc file.
|
||||
--source suite/binlog/include/binlog_expire_logs_seconds.inc
|
||||
|
||||
--echo ####
|
||||
--echo #### 2.4: binlog_expire_logs_seconds = 1
|
||||
--echo ####
|
||||
SET GLOBAL binlog_expire_logs_seconds= 1;
|
||||
SELECT @@expire_logs_days;
|
||||
SELECT @@binlog_expire_logs_seconds as Expected_1;
|
||||
|
||||
# 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
|
200
mysql-test/suite/binlog/t/binlog_expire_warnings.test
Normal file
200
mysql-test/suite/binlog/t/binlog_expire_warnings.test
Normal file
@ -0,0 +1,200 @@
|
||||
# ==== Requirements ====
|
||||
#
|
||||
# Verify the logic for warnings related to expire-logs-days and
|
||||
# binlog-expire-logs-seconds on server start:
|
||||
#
|
||||
# R0. All the following shall hold with binlog disabled and binlog enabled.
|
||||
#
|
||||
# R1. Binlog off warnings:
|
||||
#
|
||||
# R1.1. If the binary log is disabled, using any of
|
||||
# binlog-expire-logs-seconds or expire_logs_days shall
|
||||
# generate a warning.
|
||||
#
|
||||
# R1.2. If the binary log is enabled, or if
|
||||
# binlog-expire-logs-seconds / expire_logs_days is not used,
|
||||
# there shall be no warning for this case.
|
||||
#
|
||||
# R2. Values:
|
||||
#
|
||||
# R2.1. None of expire-logs-days or binlog-expire-logs-seconds is
|
||||
# set: both shall use their default values (days=0, seconds=0)
|
||||
#
|
||||
# R2.2. Exactly one of expire-logs-days or binlog-expire-logs-seconds
|
||||
# is set: that value is propogated to other variable.
|
||||
#
|
||||
# R2.3. Both expire-logs-days or binlog-expire-logs-seconds are
|
||||
# set, and at least one of them is set to zero: the last set value
|
||||
# should be effective and its value will be propogated to other
|
||||
# variable.
|
||||
#
|
||||
# R2.4. Both expire-logs-days and binlog-expire-logs-seconds are
|
||||
# set, and both are non-zero: the last set value
|
||||
# should be effective and its value will be propogated to other
|
||||
# variable.
|
||||
#
|
||||
# ==== Implementation ====
|
||||
#
|
||||
# Test all combinations of:
|
||||
#
|
||||
# - log-bin: on, off
|
||||
# - expire-logs-days: not set, set to 0, set to nonzero
|
||||
# - binlog-expire-logs-seconds: not set, set to 0, set to nonzero
|
||||
# - Verify option value propogation, by varying the order, in which options
|
||||
# are set
|
||||
# --expire_logs_days --binlog_expire_logs_seconds
|
||||
# --binlog_expire_logs_seconds --expire_logs_days
|
||||
# For each such scenario, state the expected warnings and values, and
|
||||
# use extra/binlog_tests/binlog_expire_warnings.inc to execute the
|
||||
# scenario.
|
||||
#
|
||||
# ==== References ====
|
||||
#
|
||||
# MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary
|
||||
# logs
|
||||
#
|
||||
--source include/have_binlog_format_row.inc
|
||||
|
||||
# Restarts the server with new options.
|
||||
--source include/force_restart.inc
|
||||
|
||||
# A bit slow, since it restarts the server many times. Also, this is
|
||||
# unlikely to break in the future, so not important to run frequently.
|
||||
--source include/big_test.inc
|
||||
|
||||
|
||||
--let $ofile = $MYSQLTEST_VARDIR/tmp/binlog_expire_warnings-output.err
|
||||
|
||||
--let $i = 0
|
||||
while ($i < 2) {
|
||||
|
||||
if ($i == 0) {
|
||||
--echo #### Binary log ENABLED ####
|
||||
--let $options =
|
||||
--let $binlog_off = 0
|
||||
}
|
||||
if ($i == 1) {
|
||||
--echo #### Binary log DISABLED ####
|
||||
--let $options = --skip-log-bin
|
||||
--let $binlog_off = 1
|
||||
}
|
||||
|
||||
--echo ==== Don't set any option ====
|
||||
|
||||
--let $days =
|
||||
--let $seconds =
|
||||
--let $expect_binlog_off_days_and_seconds_warning = 0
|
||||
--let $expect_days = 0
|
||||
--let $expect_seconds = 0
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ==== Set one option to zero ====
|
||||
|
||||
--echo ---- days=0 ----
|
||||
--let $days = 0
|
||||
--let $seconds =
|
||||
--let $expect_binlog_off_days_and_seconds_warning = 0
|
||||
--let $expect_days = 0
|
||||
--let $expect_seconds = 0
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ---- seconds=0 ----
|
||||
--let $days =
|
||||
--let $seconds = 0
|
||||
--let $expect_binlog_off_days_and_seconds_warning = 0
|
||||
--let $expect_days = 0
|
||||
--let $expect_seconds = 0
|
||||
--let $option_invoke_order= seconds_then_days
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ==== Set one option to non-zero ====
|
||||
|
||||
--echo ---- days=2 ----
|
||||
--let $days = 2
|
||||
--let $seconds =
|
||||
--let $expect_binlog_off_days_and_seconds_warning = $binlog_off
|
||||
--let $expect_days = 2
|
||||
--let $expect_seconds = `SELECT $days * 24 * 60 * 60`
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ---- seconds=86400 ----
|
||||
--let $days =
|
||||
--let $seconds = 86400
|
||||
--let $expect_binlog_off_days_and_seconds_warning = $binlog_off
|
||||
--let $expect_days = 1
|
||||
--let $expect_seconds = 86400
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ==== Set both options to zero ====
|
||||
|
||||
--let $days = 0
|
||||
--let $seconds = 0
|
||||
--let $expect_binlog_off_days_and_seconds_warning = 0
|
||||
--let $expect_days = 0
|
||||
--let $expect_seconds = 0
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ==== Set both options: one to zero and one to non-zero ====
|
||||
--echo ---- days=1 seconds=0 ----
|
||||
--echo ---- The later seconds=0 will override days.
|
||||
--let $days = 1
|
||||
--let $seconds = 0
|
||||
--let $expect_binlog_off_days_and_seconds_warning = 0
|
||||
--let $expect_days = 0
|
||||
--let $expect_seconds = 0
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ---- seconds=0 days=1 ----
|
||||
--echo ---- The later days=1 will override seconds.
|
||||
--let $days = 1
|
||||
--let $seconds = 0
|
||||
--let $expect_binlog_off_days_and_seconds_warning = $binlog_off
|
||||
--let $expect_days = 1
|
||||
--let $expect_seconds = 86400
|
||||
--let $option_invoke_order= seconds_then_days
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ---- days=0 seconds=86400 ----
|
||||
--echo ---- The later seconds=86400 will override days.
|
||||
--let $days = 0
|
||||
--let $seconds = 86400
|
||||
--let $expect_binlog_off_days_and_seconds_warning = $binlog_off
|
||||
--let $expect_days = 1
|
||||
--let $expect_seconds = 86400
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ==== Set both options to non-zero ====
|
||||
|
||||
--echo ---- days=1 and seconds=172800 ----
|
||||
--echo ---- Since binlog_expire_logs_seconds is set later expire_log_days
|
||||
--echo ---- becomes 2
|
||||
--let $days = 1
|
||||
--let $seconds = 172800
|
||||
--let $expect_binlog_off_days_and_seconds_warning = $binlog_off
|
||||
--let $expect_days = 2
|
||||
--let $expect_seconds = 172800
|
||||
--let $option_invoke_order= days_then_seconds
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--echo ---- days=1 and seconds=172800 ----
|
||||
--echo ---- Since expire_logs_days is set later binlog_expire_logs_seconds
|
||||
--echo ---- becomes 86400
|
||||
--let $days = 1
|
||||
--let $seconds = 172800
|
||||
--let $expect_binlog_off_days_and_seconds_warning = $binlog_off
|
||||
--let $expect_days = 1
|
||||
--let $expect_seconds = 86400
|
||||
--let $option_invoke_order= seconds_then_days
|
||||
--source suite/binlog/include/binlog_expire_warnings.inc
|
||||
|
||||
--inc $i
|
||||
}
|
||||
|
||||
# cleanup
|
||||
--remove_file $ofile
|
@ -0,0 +1,104 @@
|
||||
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
|
||||
0
|
||||
SET @@global.binlog_expire_logs_seconds = @start_value_sec;
|
||||
SELECT @@global.binlog_expire_logs_seconds = 0;
|
||||
@@global.binlog_expire_logs_seconds = 0
|
||||
1
|
||||
SET @@global.binlog_expire_logs_seconds = 0;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
0
|
||||
SET @@global.binlog_expire_logs_seconds = 99;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
99
|
||||
SET @@global.binlog_expire_logs_seconds = 10;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
10
|
||||
SET @@global.binlog_expire_logs_seconds = 21;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
21
|
||||
SET @@global.binlog_expire_logs_seconds = -1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect binlog_expire_logs_seconds value: '-1'
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
0
|
||||
SET @@global.binlog_expire_logs_seconds = 10000.01;
|
||||
ERROR 42000: Incorrect argument type to variable 'binlog_expire_logs_seconds'
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
0
|
||||
SET @@global.binlog_expire_logs_seconds = -1024;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect binlog_expire_logs_seconds value: '-1024'
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
0
|
||||
SET @@global.binlog_expire_logs_seconds = 42949672950;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect binlog_expire_logs_seconds value: '42949672950'
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
4294967295
|
||||
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
|
||||
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
|
||||
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
|
||||
SELECT @@global.binlog_expire_logs_seconds = VARIABLE_VALUE
|
||||
FROM information_schema.global_variables
|
||||
WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
|
||||
@@global.binlog_expire_logs_seconds = VARIABLE_VALUE
|
||||
1
|
||||
SELECT @@binlog_expire_logs_seconds = VARIABLE_VALUE
|
||||
FROM information_schema.session_variables
|
||||
WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
|
||||
@@binlog_expire_logs_seconds = VARIABLE_VALUE
|
||||
1
|
||||
SET @@global.binlog_expire_logs_seconds = TRUE;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
1
|
||||
SET @@global.binlog_expire_logs_seconds = FALSE;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
0
|
||||
SET @@global.binlog_expire_logs_seconds = 1;
|
||||
SELECT @@binlog_expire_logs_seconds = @@global.binlog_expire_logs_seconds;
|
||||
@@binlog_expire_logs_seconds = @@global.binlog_expire_logs_seconds
|
||||
1
|
||||
SET binlog_expire_logs_seconds = 1;
|
||||
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
|
||||
1
|
||||
SELECT local.binlog_expire_logs_seconds;
|
||||
ERROR 42S02: Unknown table 'local' in field list
|
||||
SELECT global.binlog_expire_logs_seconds;
|
||||
ERROR 42S02: Unknown table 'global' in field list
|
||||
SELECT binlog_expire_logs_seconds = @@session.binlog_expire_logs_seconds;
|
||||
ERROR 42S22: Unknown column 'binlog_expire_logs_seconds' in 'field list'
|
||||
SET @@global.binlog_expire_logs_seconds = @start_value_sec;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
@@global.binlog_expire_logs_seconds
|
||||
0
|
@ -0,0 +1,47 @@
|
||||
#
|
||||
# MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs
|
||||
# Test that "SET binlog_expire_logs_seconds" is not allowed without BINLOG ADMIN or SUPER
|
||||
#
|
||||
SET @global=@@global.binlog_expire_logs_seconds;
|
||||
# Test that "SET binlog_expire_logs_seconds" is not allowed without BINLOG ADMIN or SUPER
|
||||
CREATE USER user1@localhost;
|
||||
GRANT ALL PRIVILEGES ON *.* TO user1@localhost;
|
||||
REVOKE BINLOG ADMIN, SUPER ON *.* FROM user1@localhost;
|
||||
connect user1,localhost,user1,,;
|
||||
connection user1;
|
||||
SET GLOBAL binlog_expire_logs_seconds=10;
|
||||
ERROR 42000: Access denied; you need (at least one of) the SUPER, BINLOG ADMIN privilege(s) for this operation
|
||||
SET binlog_expire_logs_seconds=10;
|
||||
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET SESSION binlog_expire_logs_seconds=10;
|
||||
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
disconnect user1;
|
||||
connection default;
|
||||
DROP USER user1@localhost;
|
||||
# Test that "SET binlog_expire_logs_seconds" is allowed with BINLOG ADMIN
|
||||
CREATE USER user1@localhost;
|
||||
GRANT BINLOG ADMIN ON *.* TO user1@localhost;
|
||||
connect user1,localhost,user1,,;
|
||||
connection user1;
|
||||
SET GLOBAL binlog_expire_logs_seconds=10;
|
||||
SET binlog_expire_logs_seconds=10;
|
||||
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET SESSION binlog_expire_logs_seconds=10;
|
||||
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
disconnect user1;
|
||||
connection default;
|
||||
DROP USER user1@localhost;
|
||||
# Test that "SET binlog_expire_logs_seconds" is allowed with SUPER
|
||||
CREATE USER user1@localhost;
|
||||
GRANT SUPER ON *.* TO user1@localhost;
|
||||
connect user1,localhost,user1,,;
|
||||
connection user1;
|
||||
SET GLOBAL binlog_expire_logs_seconds=10;
|
||||
SET binlog_expire_logs_seconds=10;
|
||||
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SET SESSION binlog_expire_logs_seconds=10;
|
||||
ERROR HY000: Variable 'binlog_expire_logs_seconds' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
disconnect user1;
|
||||
connection default;
|
||||
DROP USER user1@localhost;
|
||||
SET @@global.binlog_expire_logs_seconds=@global;
|
@ -14,71 +14,72 @@ SELECT @@global.expire_logs_days = @start_value;
|
||||
SET @@global.expire_logs_days = 0;
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
0
|
||||
0.000000
|
||||
SET @@global.expire_logs_days = 99;
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET @@global.expire_logs_days = 10;
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
10
|
||||
10.000000
|
||||
SET @@global.expire_logs_days = 21;
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
21
|
||||
21.000000
|
||||
'#--------------------FN_DYNVARS_029_04-------------------------#'
|
||||
SET @@global.expire_logs_days = -1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect expire_logs_days value: '-1'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
0
|
||||
0.000000
|
||||
SET @@global.expire_logs_days = 100;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect expire_logs_days value: '100'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET @@global.expire_logs_days = 1024;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect expire_logs_days value: '1024'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET @@global.expire_logs_days = 10000.01;
|
||||
ERROR 42000: Incorrect argument type to variable 'expire_logs_days'
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect expire_logs_days value: '10000.01'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET @@global.expire_logs_days = -1024;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect expire_logs_days value: '-1024'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
0
|
||||
0.000000
|
||||
SET @@global.expire_logs_days = 42949672950;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect expire_logs_days value: '42949672950'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET @@global.expire_logs_days = ON;
|
||||
ERROR 42000: Incorrect argument type to variable 'expire_logs_days'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
SET @@global.expire_logs_days = 'test';
|
||||
ERROR 42000: Incorrect argument type to variable 'expire_logs_days'
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
'#-------------------FN_DYNVARS_029_05----------------------------#'
|
||||
SET @@session.expire_logs_days = 0;
|
||||
ERROR HY000: Variable 'expire_logs_days' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SELECT @@expire_logs_days;
|
||||
@@expire_logs_days
|
||||
99
|
||||
99.000000
|
||||
'#----------------------FN_DYNVARS_029_06------------------------#'
|
||||
SELECT @@global.expire_logs_days = VARIABLE_VALUE
|
||||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
@ -94,11 +95,11 @@ WHERE VARIABLE_NAME='expire_logs_days';
|
||||
SET @@global.expire_logs_days = TRUE;
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
1
|
||||
1.000000
|
||||
SET @@global.expire_logs_days = FALSE;
|
||||
SELECT @@global.expire_logs_days;
|
||||
@@global.expire_logs_days
|
||||
0
|
||||
0.000000
|
||||
'#---------------------FN_DYNVARS_029_08----------------------#'
|
||||
SET @@global.expire_logs_days = 1;
|
||||
SELECT @@expire_logs_days = @@global.expire_logs_days;
|
||||
@ -109,7 +110,7 @@ SET expire_logs_days = 1;
|
||||
ERROR HY000: Variable 'expire_logs_days' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
SELECT @@expire_logs_days;
|
||||
@@expire_logs_days
|
||||
1
|
||||
1.000000
|
||||
SELECT local.expire_logs_days;
|
||||
ERROR 42S02: Unknown table 'local' in field list
|
||||
SELECT global.expire_logs_days;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -382,6 +382,16 @@ NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY NO
|
||||
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.
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MAX_VALUE 4294967295
|
||||
NUMERIC_BLOCK_SIZE 1
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME BINLOG_FILE_CACHE_SIZE
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
@ -904,11 +914,11 @@ READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME EXPIRE_LOGS_DAYS
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation
|
||||
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
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MAX_VALUE 99
|
||||
NUMERIC_BLOCK_SIZE 1
|
||||
NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -382,6 +382,16 @@ NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY NO
|
||||
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.
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MAX_VALUE 4294967295
|
||||
NUMERIC_BLOCK_SIZE 1
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME BINLOG_FILE_CACHE_SIZE
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
@ -924,11 +934,11 @@ READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME EXPIRE_LOGS_DAYS
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BIGINT UNSIGNED
|
||||
VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation
|
||||
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
|
||||
NUMERIC_MIN_VALUE 0
|
||||
NUMERIC_MAX_VALUE 99
|
||||
NUMERIC_BLOCK_SIZE 1
|
||||
NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
|
@ -0,0 +1,136 @@
|
||||
############## mysql-test\t\binlog_expire_logs_seconds_basic.test ################
|
||||
# #
|
||||
# Variable Name: binlog_expire_logs_seconds #
|
||||
# Scope: GLOBAL #
|
||||
# Access Type: Dynamic #
|
||||
# Data Type: numeric #
|
||||
# Default Value:0 #
|
||||
# Range: 0- (2^32 -1) #
|
||||
# #
|
||||
# #
|
||||
# Creation Date: 2017-11-28 #
|
||||
# Author: Neha kumari #
|
||||
# #
|
||||
# Description: Test Cases of Dynamic System Variable #
|
||||
# binlog_expire_logs_seconds that checks the behavior of this #
|
||||
# variable in the following ways #
|
||||
# * Default Value #
|
||||
# * Valid & Invalid values #
|
||||
# * Scope & Access method #
|
||||
# * Data Integrity #
|
||||
# #
|
||||
# Reference: https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#
|
||||
# #
|
||||
##################################################################################
|
||||
|
||||
--source include/load_sysvars.inc
|
||||
|
||||
########################################################################
|
||||
# START OF binlog_expire_logs_seconds TESTS #
|
||||
########################################################################
|
||||
|
||||
SET @start_value_sec = @@global.binlog_expire_logs_seconds;
|
||||
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;
|
||||
|
||||
###############################################
|
||||
# Verify default value of variable #
|
||||
###############################################
|
||||
|
||||
SET @@global.binlog_expire_logs_seconds = @start_value_sec;
|
||||
SELECT @@global.binlog_expire_logs_seconds = 0;
|
||||
|
||||
##################################################################################
|
||||
# Change the value of binlog_expire_logs_seconds to a valid value #
|
||||
##################################################################################
|
||||
|
||||
SET @@global.binlog_expire_logs_seconds = 0;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
SET @@global.binlog_expire_logs_seconds = 99;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
SET @@global.binlog_expire_logs_seconds = 10;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
SET @@global.binlog_expire_logs_seconds = 21;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
|
||||
#####################################################################################
|
||||
# Change the value of binlog_expire_logs_seconds to invalid value #
|
||||
#####################################################################################
|
||||
|
||||
SET @@global.binlog_expire_logs_seconds = -1;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
--Error ER_WRONG_TYPE_FOR_VAR
|
||||
SET @@global.binlog_expire_logs_seconds = 10000.01;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
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;
|
||||
|
||||
--Error ER_WRONG_TYPE_FOR_VAR
|
||||
SET @@global.binlog_expire_logs_seconds = ON;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
--Error ER_WRONG_TYPE_FOR_VAR
|
||||
SET @@global.binlog_expire_logs_seconds = 'test';
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
|
||||
#####################################################################################
|
||||
# Test if accessing session binlog_expire_logs_seconds gives error #
|
||||
#####################################################################################
|
||||
|
||||
--Error ER_GLOBAL_VARIABLE
|
||||
SET @@session.binlog_expire_logs_seconds = 0;
|
||||
SELECT @@binlog_expire_logs_seconds;
|
||||
|
||||
##############################################################################
|
||||
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
|
||||
##############################################################################
|
||||
|
||||
--disable_warnings
|
||||
SELECT @@global.binlog_expire_logs_seconds = VARIABLE_VALUE
|
||||
FROM information_schema.global_variables
|
||||
WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
|
||||
|
||||
SELECT @@binlog_expire_logs_seconds = VARIABLE_VALUE
|
||||
FROM information_schema.session_variables
|
||||
WHERE VARIABLE_NAME='binlog_expire_logs_seconds';
|
||||
--enable_warnings
|
||||
|
||||
###################################################################
|
||||
# Check if TRUE and FALSE values can be used on variable #
|
||||
###################################################################
|
||||
|
||||
SET @@global.binlog_expire_logs_seconds = TRUE;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
SET @@global.binlog_expire_logs_seconds = FALSE;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
||||
|
||||
|
||||
####################################################################################
|
||||
# Check if binlog_expire_logs_seconds can be accessed with and without @@ sign #
|
||||
####################################################################################
|
||||
SET @@global.binlog_expire_logs_seconds = 1;
|
||||
SELECT @@binlog_expire_logs_seconds = @@global.binlog_expire_logs_seconds;
|
||||
|
||||
--Error ER_GLOBAL_VARIABLE
|
||||
SET binlog_expire_logs_seconds = 1;
|
||||
SELECT @@binlog_expire_logs_seconds;
|
||||
--Error ER_UNKNOWN_TABLE
|
||||
SELECT local.binlog_expire_logs_seconds;
|
||||
--Error ER_UNKNOWN_TABLE
|
||||
SELECT global.binlog_expire_logs_seconds;
|
||||
--Error ER_BAD_FIELD_ERROR
|
||||
SELECT binlog_expire_logs_seconds = @@session.binlog_expire_logs_seconds;
|
||||
|
||||
##############################
|
||||
# Restore initial value #
|
||||
##############################
|
||||
|
||||
SET @@global.binlog_expire_logs_seconds = @start_value_sec;
|
||||
SELECT @@global.binlog_expire_logs_seconds;
|
@ -0,0 +1,10 @@
|
||||
--echo #
|
||||
--echo # MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs
|
||||
--echo # Test that "SET binlog_expire_logs_seconds" is not allowed without BINLOG ADMIN or SUPER
|
||||
--echo #
|
||||
|
||||
--let var = binlog_expire_logs_seconds
|
||||
--let grant = BINLOG ADMIN
|
||||
--let value = 10
|
||||
|
||||
--source suite/sys_vars/inc/sysvar_global_grant.inc
|
@ -3,7 +3,7 @@
|
||||
# Variable Name: expire_logs_days #
|
||||
# Scope: GLOBAL #
|
||||
# Access Type: Dynamic #
|
||||
# Data Type: numeric #
|
||||
# Data Type: double #
|
||||
# Default Value:0 #
|
||||
# Range: 0-99 #
|
||||
# #
|
||||
@ -83,7 +83,6 @@ SET @@global.expire_logs_days = 100;
|
||||
SELECT @@global.expire_logs_days;
|
||||
SET @@global.expire_logs_days = 1024;
|
||||
SELECT @@global.expire_logs_days;
|
||||
--Error ER_WRONG_TYPE_FOR_VAR
|
||||
SET @@global.expire_logs_days = 10000.01;
|
||||
SELECT @@global.expire_logs_days;
|
||||
SET @@global.expire_logs_days = -1024;
|
||||
|
Reference in New Issue
Block a user