From: Date: May 12 2006 3:26pm Subject: bk commit into 5.0 tree (ramil:1.2131) BUG#19764 List-Archive: http://lists.mysql.com/commits/6301 X-Bug: 19764 Message-Id: <200605121326.k4CDQpw3048924@myoffice.izhnet.ru> Below is the list of changes that have just been committed into a local 5.0 repository of ram. When ram 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 1.2131 06/05/12 18:26:44 ramil@stripped +3 -0 Fix for bug #19764: SHOW commands end up in the slow log as table scans sql/sql_prepare.cc 1.179 06/05/12 18:26:36 ramil@stripped +6 -0 Fix for bug #19764: SHOW commands end up in the slow log as table scans - don't log SHOW commands into slow log. sql/sql_parse.cc 1.544 06/05/12 18:26:36 ramil@stripped +3 -1 Fix for bug #19764: SHOW commands end up in the slow log as table scans - don't log SHOW commands into slow log. mysql-test/r/union.result 1.82 06/05/12 18:26:36 ramil@stripped +4 -4 Fix for bug #19764: SHOW commands end up in the slow log as table scans - test result adjusted. # 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: ramil # Host: myoffice.izhnet.ru # Root: /usr/home/ram/work/5.0.b19764 --- 1.543/sql/sql_parse.cc 2006-05-06 12:25:53 +05:00 +++ 1.544/sql/sql_parse.cc 2006-05-12 18:26:36 +05:00 @@ -2130,8 +2130,10 @@ void log_slow_statement(THD *thd) /* Do not log administrative statements unless the appropriate option is set; do not log into slow log if reading from backup. + Don't log SHOW commands. */ - if (thd->enable_slow_log && !thd->user_time) + if (thd->enable_slow_log && !thd->user_time && + (thd->lex->orig_sql_command == SQLCOM_END)) { thd->proc_info="logging slow query"; --- 1.81/mysql-test/r/union.result 2006-03-06 16:19:38 +04:00 +++ 1.82/mysql-test/r/union.result 2006-05-12 18:26:36 +05:00 @@ -836,27 +836,27 @@ count(*) 26 show status like 'Slow_queries'; Variable_name Value -Slow_queries 1 +Slow_queries 0 select count(*) from t1 where b=13; count(*) 10 show status like 'Slow_queries'; Variable_name Value -Slow_queries 3 +Slow_queries 1 select count(*) from t1 where b=13 union select count(*) from t1 where a=7; count(*) 10 26 show status like 'Slow_queries'; Variable_name Value -Slow_queries 5 +Slow_queries 2 select count(*) from t1 where a=7 union select count(*) from t1 where b=13; count(*) 26 10 show status like 'Slow_queries'; Variable_name Value -Slow_queries 7 +Slow_queries 3 flush status; select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6); a --- 1.178/sql/sql_prepare.cc 2006-05-08 04:14:38 +05:00 +++ 1.179/sql/sql_prepare.cc 2006-05-12 18:26:36 +05:00 @@ -2914,6 +2914,12 @@ bool Prepared_statement::execute(String stmt_backup.query_length= thd->query_length; /* + Set orig_sql_command as we use it after restoring from backup + to disable slow logging for SHOW commands (see log_slow_statement()). + */ + stmt_backup.lex->orig_sql_command= thd->lex->orig_sql_command; + + /* At first execution of prepared statement we may perform logical transformations of the query tree. Such changes should be performed on the parse tree of current prepared statement and new items should