List:Commits« Previous MessageNext Message »
From:tim Date:October 3 2006 12:51am
Subject:bk commit into 5.0 tree (tsmith:1.2302) BUG#19764
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tim. When tim does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-02 18:51:12-06:00, tsmith@stripped +3 -0
  Bug #19764: SHOW commands end up in the slow log as table scans
  
  Set a flag when a SHOW command is parsed, and check it in MYSQL_LOG::write().  Do not write to the slow queries log file if it is a SHOW command.

  sql/log.cc@stripped, 2006-10-02 18:51:08-06:00, tsmith@stripped +4 -0
    Return immediately from MYSQL_LOG::write() (for slow query log) if thd->lex->is_slow_command is set

  sql/sql_lex.h@stripped, 2006-10-02 18:51:08-06:00, tsmith@stripped +7 -0
    Add LEX->is_slow_command flag to prevent SHOW commands from being written to the slow queries log

  sql/sql_yacc.yy@stripped, 2006-10-02 18:51:08-06:00, tsmith@stripped +1 -0
    Set lex->is_show_command for all SHOW commands

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	tsmith
# Host:	siva.hindu.god
# Root:	/usr/home/tim/m/bk/b19764/50

--- 1.194/sql/log.cc	2006-10-02 18:51:23 -06:00
+++ 1.195/sql/log.cc	2006-10-02 18:51:23 -06:00
@@ -1935,6 +1935,10 @@ bool MYSQL_LOG::write(THD *thd,const cha
     return 0;
   DBUG_ENTER("MYSQL_LOG::write");
 
+  // SHOW commands are never logged as slow queries
+  if (thd->lex->is_show_command)
+    DBUG_RETURN(0);
+
   VOID(pthread_mutex_lock(&LOCK_log));
   if (is_open())
   {						// Safety agains reopen

--- 1.228/sql/sql_lex.h	2006-10-02 18:51:23 -06:00
+++ 1.229/sql/sql_lex.h	2006-10-02 18:51:23 -06:00
@@ -1016,6 +1016,13 @@ typedef struct st_lex : public Query_tab
   
   bool escape_used;
 
+  /*
+    Prevent SHOW commands from being written to the slow queries log.
+    This is fixed properly in MySQL 5.1, but a quick hack is used in 5.0
+    to achieve the same result.
+  */
+  bool is_show_command;
+
   st_lex();
 
   virtual ~st_lex()

--- 1.491/sql/sql_yacc.yy	2006-10-02 18:51:23 -06:00
+++ 1.492/sql/sql_yacc.yy	2006-10-02 18:51:23 -06:00
@@ -6412,6 +6412,7 @@ opt_table_sym:
 show:	SHOW
 	{
 	  LEX *lex=Lex;
+          lex->is_show_command= 1;
 	  lex->wild=0;
           lex->lock_option= TL_READ;
           mysql_init_select(lex);
Thread
bk commit into 5.0 tree (tsmith:1.2302) BUG#19764tim3 Oct