mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +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:
48
sql/log.cc
48
sql/log.cc
@ -965,6 +965,54 @@ bool LOGGER::flush_logs(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Close and reopen the slow log (with locks).
|
||||
|
||||
@returns FALSE.
|
||||
*/
|
||||
bool LOGGER::flush_slow_log()
|
||||
{
|
||||
/*
|
||||
Now we lock logger, as nobody should be able to use logging routines while
|
||||
log tables are closed
|
||||
*/
|
||||
logger.lock_exclusive();
|
||||
|
||||
/* Reopen slow log file */
|
||||
if (opt_slow_log)
|
||||
file_log_handler->get_mysql_slow_log()->reopen_file();
|
||||
|
||||
/* End of log flush */
|
||||
logger.unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Close and reopen the general log (with locks).
|
||||
|
||||
@returns FALSE.
|
||||
*/
|
||||
bool LOGGER::flush_general_log()
|
||||
{
|
||||
/*
|
||||
Now we lock logger, as nobody should be able to use logging routines while
|
||||
log tables are closed
|
||||
*/
|
||||
logger.lock_exclusive();
|
||||
|
||||
/* Reopen general log file */
|
||||
if (opt_log)
|
||||
file_log_handler->get_mysql_log()->reopen_file();
|
||||
|
||||
/* End of log flush */
|
||||
logger.unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Log slow query with all enabled log event handlers
|
||||
|
||||
|
Reference in New Issue
Block a user