mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
ac647f5a3e
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.
172 lines
5.8 KiB
Text
172 lines
5.8 KiB
Text
#
|
|
# 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;
|
|
|