ourdelta-developers team mailing list archive
-
ourdelta-developers team
-
Mailing list archive
-
Message #00067
FLUSH SLOW QUERY LOG[S]
Hi Mark
As I mentioned earlier I split that one out of the userstatsv2 (5.0),
where it was hiding ;-)
So I was just porting it to 5.1, and noticed that it's in sql/
sql_parse.cc:mysql_execute_command() under case SQLCOM_FLUSH, where
it does its thing and skips out:
if(lex->type & REFRESH_SLOW_QUERY_LOG) {
/* We are only flushing slow query log */
mysql_slow_log.new_file(1);
send_ok(thd);
break;
}
That seems like the wrong spot, doesn't it belong in
reload_acl_and_cache() where all the REFRESH stuff is handled?
That would also make it (automatically) subject to the [LOCAL |
NO_WRITE_TO_BINLOG] option.
And since the syntax is FLUSH [LOCAL | NO_WRITE_TO_BINLOG]
flush_option [, flush_option] ...
the original patch behaviour actually breaks that; if any of the flush
options is SLOW QUERY LOG[S] it would (in the original code) only
flush the slow log and skip out, and not flush anything else - but the
parser will have accepted it anyway.
So I've done the following, in reload_acl_and_cache():
--- mysql-5.1.28-rc.orig/sql/sql_parse.cc
+++ mysql-5.1.28-rc/sql/sql_parse.cc
@@ -6609,6 +6609,15 @@ bool reload_acl_and_cache(THD *thd, ulon
if (flush_error_log())
result=1;
}
+
+ if (options & REFRESH_SLOW_QUERY_LOG)
+ {
+ /*
+ We are only flushing slow query log
+ */
+ mysql_slow_log.new_file(1);
+ }
+
#ifdef HAVE_QUERY_CACHE
if (options & REFRESH_QUERY_CACHE_FREE)
{
The only caveat is that if someone were to say FLUSH SLOW,SLOW QUERY
LOG[S] then it would flush the slow query log twice.
But heck, then it's only doing what it's told ;-)
What do you think?
Cheers,
Arjen.
--
Arjen Lentz, Director @ Open Query (http://openquery.com.au/)
Training and Expertise for MySQL in Australia and New Zealand
OurDelta: free enhanced builds for MySQL @ http://ourdelta.org/
Follow ups