mirror of
https://github.com/MariaDB/server.git
synced 2025-02-04 21:02:17 +01:00
7e1ec1550c
Post push fixes. * Set binlog_expire_logs_seconds max valid value to 8553600 i.e 99 * 24 * 60 * 60 (99 days)
122 lines
4.2 KiB
Text
122 lines
4.2 KiB
Text
#
|
|
# 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
|
|
# 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.
|
|
|
|
# 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;
|
|
|
|
--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
|