Hi!
On Jul 25, kgeorge@stripped wrote:
> ChangeSet@stripped, 2007-07-25 16:56:49+03:00, gkodinov@stripped +3 -0
> Bug #30000: SHOW commands once again ends up in the slow query log
>
> All SHOW commands must not enter the slow query log.
>
> Extended the 5.1 fix for bug 19764 to cover all the SHOW commands
> (instead of only SHOW STATUS). This makes it compatible with the
> 5.0 behavior.
>
> mysql-test/r/show_check.result@stripped, 2007-07-25 16:56:46+03:00,
> gkodinov@stripped +64 -5
> Bug #30000: test case and tests update
>
> mysql-test/t/show_check.test@stripped, 2007-07-25 16:56:46+03:00, gkodinov@stripped
> +68 -0
> Bug #30000: test case and tests update
>
> sql/sql_parse.cc@stripped, 2007-07-25 16:56:46+03:00, gkodinov@stripped +21 -0
> Bug #30000: don't include SHOW commands into the binlog.
Your patch will work, but don't you think the code is getting more
unmaintainable and fragile that way - every show command need to
remember to reset these flags in thd->server_status.
I'd prefer a different solution:
--- 1.693/sql/sql_parse.cc 2007-07-26 18:34:06 +02:00
+++ edited/sql_parse.cc 2007-07-26 18:33:40 +02:00
@@ -1323,7 +1323,8 @@ void log_slow_statement(THD *thd)
thd->variables.long_query_time ||
((thd->server_status &
(SERVER_QUERY_NO_INDEX_USED | SERVER_QUERY_NO_GOOD_INDEX_USED)) &&
- opt_log_queries_not_using_indexes))
+ opt_log_queries_not_using_indexes &&
+ !(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND)))
{
thd->status_var.long_query_count++;
slow_log_print(thd, thd->query, thd->query_length, start_of_query);
This will cover all SHOW commands, including whatever can be added in
the future.
Regards / Mit vielen Grüssen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Developer
/_/ /_/\_, /___/\___\_\___/ MySQL GmbH, Radlkoferstr. 2, D-81373 München
<___/ Geschäftsführer: Kaj Arnö - HRB
München 162140