Serg,
On 26.07.2007, at 19:35, Sergei Golubchik wrote:
> 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.
<skip>
> 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.
This is indeed the more natural way of fixing the bug. But it also
introduces overhead that Monty wanted to avoid : hence the fix for
5.1 is different from the one in 5.0. See Monty's comments in bug
#19764 (dated [19 Jun 2006 11:08]).
Best Regards,
Joro
--
Georgi Kodinov, Senior Software Engineer
MySQL AB, Plovdiv, Bulgaria, www.mysql.com
Office: +359 32 634 397 Mobile: +359 887 700 566 Skype: georgekodinov
Are you MySQL certified? www.mysql.com/certification