mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#5142 FLUSH LOGS should take optional arguments for which log(s) to flush
Support for flushing individual logs, so that the user can selectively flush a subset of the server logs. Flush of individual logs is done according to the following syntax: FLUSH <log_category> LOGS; The syntax is extended so that the user is able to flush a subset of logs: FLUSH [log_category LOGS,]; where log_category is one of: SLOW ERROR BINARY ENGINE GENERAL RELAY. mysql-test/suite/rpl/r/rpl_flush_logs.result: Test result for WL#5142. mysql-test/suite/rpl/t/rpl_flush_logs.test: Added the test file to verify if the 'flush individual log' statement works fine. sql/log.cc: Added the two functions to flush slow and general log. sql/sql_parse.cc: Added code to flush specified logs against the option. sql/sql_yacc.yy: Added code to parse the 'flush * log' statement syntax and set its option to Lex->type.
This commit is contained in:
67
mysql-test/suite/rpl/r/rpl_flush_logs.result
Normal file
67
mysql-test/suite/rpl/r/rpl_flush_logs.result
Normal file
@ -0,0 +1,67 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
# Make sure the 'master_log.err-old' file does not
|
||||
# exist before execute 'flush error logs' statement.
|
||||
# Test if support 'flush error logs' statement.
|
||||
flush error logs;
|
||||
# Check the 'master_log.err-old' file is created
|
||||
# after executed 'flush error logs' statement.
|
||||
# Make sure binary logs was not be flushed
|
||||
# after execute 'flush error logs' statement.
|
||||
# Make sure relay logs was not be flushed
|
||||
# after execute 'flush error logs' statement.
|
||||
# Make sure the 'slave-relay-bin.000004' file does not
|
||||
# exist before execute 'flush relay logs' statement.
|
||||
# Test if support 'flush relay logs' statement.
|
||||
flush relay logs;
|
||||
# Check the 'slave-relay-bin.000004' file is created
|
||||
# after executed 'flush relay logs' statement.
|
||||
# Make sure binary logs was not be flushed
|
||||
# after execute 'flush relay logs' statement.
|
||||
# Test if support 'flush slow logs' statement.
|
||||
flush slow logs;
|
||||
# Make sure binary logs was not be flushed
|
||||
# after execute 'flush slow logs' statement.
|
||||
# Test if support 'flush general logs' statement.
|
||||
flush general logs;
|
||||
# Make sure binary logs was not be flushed
|
||||
# after execute 'flush general logs' statement.
|
||||
# Test if support 'flush engine logs' statement.
|
||||
flush engine logs;
|
||||
# Make sure binary logs was not be flushed
|
||||
# after execute 'flush engine logs' statement.
|
||||
# Make sure the 'master-bin.000002' file does not
|
||||
# exist before execute 'flush binary logs' statement.
|
||||
# Test if support 'flush binary logs' statement.
|
||||
flush binary logs;
|
||||
# Check the 'master-bin.000002' file is created
|
||||
# after executed 'flush binary logs' statement.
|
||||
# Make sure the 'slave-relay-bin.000007' file does not exist
|
||||
# exist before execute 'flush error logs, relay logs' statement.
|
||||
# Make sure the 'master_log.err-old' file does not exist
|
||||
# before execute 'flush error logs, relay logs' statement.
|
||||
# Test if support to combine all kinds of logs into one statement.
|
||||
flush error logs, relay logs;
|
||||
# Check the 'master_log.err-old' file is created
|
||||
# after executed 'flush error logs, relay logs' statement.
|
||||
# Make sure binary logs was not be flushed
|
||||
# after execute 'flush error logs, relay logs' statement.
|
||||
# Check the 'slave-relay-bin.000007' file is created after
|
||||
# execute 'flush error logs, relay logs' statement.
|
||||
# Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
|
||||
# files do not exist before execute 'flush error logs, relay logs'
|
||||
# statement.
|
||||
# Make sure the 'master_log.err-old' file does not exist
|
||||
# before execute 'flush logs' statement.
|
||||
# Test if 'flush logs' statement works fine and flush all the logs.
|
||||
flush logs;
|
||||
# Check the 'master_log.err-old' file is created
|
||||
# after executed 'flush logs' statement.
|
||||
# Check 'master-bin.000003' is created
|
||||
# after execute 'flush logs' statement.
|
||||
# Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
|
||||
# files are created after execute 'flush logs' statement.
|
1
mysql-test/suite/rpl/t/rpl_flush_logs-master.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_flush_logs-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--log-error=$MYSQLTEST_VARDIR/tmp/master_log.err
|
172
mysql-test/suite/rpl/t/rpl_flush_logs.test
Normal file
172
mysql-test/suite/rpl/t/rpl_flush_logs.test
Normal file
@ -0,0 +1,172 @@
|
||||
#
|
||||
# WL#5124
|
||||
# This test verifies if the 'flush individual logs' statement
|
||||
# works fine.
|
||||
#
|
||||
|
||||
--source include/master-slave.inc
|
||||
--source include/have_binlog_format_statement.inc
|
||||
connection master;
|
||||
|
||||
# Test 'flush error logs' statement.
|
||||
--echo # Make sure the 'master_log.err-old' file does not
|
||||
--echo # exist before execute 'flush error logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
|
||||
--echo # Test if support 'flush error logs' statement.
|
||||
flush error logs;
|
||||
|
||||
--echo # Check the 'master_log.err-old' file is created
|
||||
--echo # after executed 'flush error logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
|
||||
|
||||
--echo # Make sure binary logs was not be flushed
|
||||
--echo # after execute 'flush error logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo # Make sure relay logs was not be flushed
|
||||
--echo # after execute 'flush error logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
|
||||
|
||||
|
||||
# Test 'flush relay logs' statement.
|
||||
--echo # Make sure the 'slave-relay-bin.000004' file does not
|
||||
--echo # exist before execute 'flush relay logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
|
||||
|
||||
connection master;
|
||||
--echo # Test if support 'flush relay logs' statement.
|
||||
flush relay logs;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo # Check the 'slave-relay-bin.000004' file is created
|
||||
--echo # after executed 'flush relay logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000004;
|
||||
|
||||
connection master;
|
||||
--echo # Make sure binary logs was not be flushed
|
||||
--echo # after execute 'flush relay logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
|
||||
|
||||
# Test 'flush slow logs' statement.
|
||||
--echo # Test if support 'flush slow logs' statement.
|
||||
flush slow logs;
|
||||
|
||||
--echo # Make sure binary logs was not be flushed
|
||||
--echo # after execute 'flush slow logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
|
||||
|
||||
# Test 'flush general logs' statement.
|
||||
--echo # Test if support 'flush general logs' statement.
|
||||
flush general logs;
|
||||
|
||||
--echo # Make sure binary logs was not be flushed
|
||||
--echo # after execute 'flush general logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
|
||||
|
||||
# Test 'flush engine logs' statement.
|
||||
--echo # Test if support 'flush engine logs' statement.
|
||||
flush engine logs;
|
||||
|
||||
--echo # Make sure binary logs was not be flushed
|
||||
--echo # after execute 'flush engine logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
|
||||
|
||||
# Test 'flush binary logs' statement.
|
||||
--echo # Make sure the 'master-bin.000002' file does not
|
||||
--echo # exist before execute 'flush binary logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
|
||||
--echo # Test if support 'flush binary logs' statement.
|
||||
flush binary logs;
|
||||
|
||||
--echo # Check the 'master-bin.000002' file is created
|
||||
--echo # after executed 'flush binary logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000002;
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000001;
|
||||
|
||||
|
||||
# Test 'flush error logs, relay logs' statement
|
||||
sync_slave_with_master;
|
||||
--echo # Make sure the 'slave-relay-bin.000007' file does not exist
|
||||
--echo # exist before execute 'flush error logs, relay logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
|
||||
|
||||
connection master;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
|
||||
--echo # Make sure the 'master_log.err-old' file does not exist
|
||||
--echo # before execute 'flush error logs, relay logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
|
||||
--echo # Test if support to combine all kinds of logs into one statement.
|
||||
flush error logs, relay logs;
|
||||
|
||||
--echo # Check the 'master_log.err-old' file is created
|
||||
--echo # after executed 'flush error logs, relay logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
|
||||
|
||||
--echo # Make sure binary logs was not be flushed
|
||||
--echo # after execute 'flush error logs, relay logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo # Check the 'slave-relay-bin.000007' file is created after
|
||||
--echo # execute 'flush error logs, relay logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000007;
|
||||
|
||||
|
||||
# Test 'flush logs' statement
|
||||
--echo # Make sure the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
|
||||
--echo # files do not exist before execute 'flush error logs, relay logs'
|
||||
--echo # statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009;
|
||||
|
||||
connection master;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
|
||||
--echo # Make sure the 'master_log.err-old' file does not exist
|
||||
--echo # before execute 'flush logs' statement.
|
||||
--error 1
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
|
||||
--echo # Test if 'flush logs' statement works fine and flush all the logs.
|
||||
flush logs;
|
||||
|
||||
--echo # Check the 'master_log.err-old' file is created
|
||||
--echo # after executed 'flush logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err-old;
|
||||
file_exists $MYSQLTEST_VARDIR/tmp/master_log.err;
|
||||
|
||||
--echo # Check 'master-bin.000003' is created
|
||||
--echo # after execute 'flush logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.1/data/master-bin.000003;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo # Check the 'slave-relay-bin.000008' and 'slave-relay-bin.000009'
|
||||
--echo # files are created after execute 'flush logs' statement.
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000008;
|
||||
file_exists $MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.000009;
|
||||
|
Reference in New Issue
Block a user