From f0c6ce9adec82ceec054b0f6e973ab1526a033c4 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 23 Sep 2011 13:55:01 +0300 Subject: [PATCH] Fixed issue with slow query logging where examined rows where wrong Reset 'examined_rows_count' in union to not count same rows twice mysql-test/r/subselect_mat_cost.result: Test also slow query logging mysql-test/t/subselect_mat_cost.test: Test also slow query logging sql/sql_union.cc: Reset 'examined_rows_count' in union to not count same rows twice --- mysql-test/r/subselect_mat_cost.result | 1 + mysql-test/t/subselect_mat_cost.test | 5 +++++ sql/sql_union.cc | 1 + 3 files changed, 7 insertions(+) diff --git a/mysql-test/r/subselect_mat_cost.result b/mysql-test/r/subselect_mat_cost.result index a642c498e53..e8312c837e6 100644 --- a/mysql-test/r/subselect_mat_cost.result +++ b/mysql-test/r/subselect_mat_cost.result @@ -1,5 +1,6 @@ set @subselect_mat_cost=@@optimizer_switch; set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; +set log_slow_time=0.1; TEST GROUP 1: Typical cases of in-to-exists and materialization subquery strategies ===================================================================== diff --git a/mysql-test/t/subselect_mat_cost.test b/mysql-test/t/subselect_mat_cost.test index 8a0d1ac702d..9d7d950114c 100644 --- a/mysql-test/t/subselect_mat_cost.test +++ b/mysql-test/t/subselect_mat_cost.test @@ -15,6 +15,11 @@ set @subselect_mat_cost=@@optimizer_switch; set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; +# +# Test logging to slow log (there was some errors in the log files about +# the slow log when running under valgrind, so better to get this tested) +# +set log_slow_time=0.1; -- echo TEST GROUP 1: diff --git a/sql/sql_union.cc b/sql/sql_union.cc index d2cb21a59a1..50de42d153c 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -645,6 +645,7 @@ bool st_select_lex_unit::exec() if (!saved_error) { examined_rows+= thd->examined_row_count; + thd->examined_row_count= 0; if (union_result->flush()) { thd->lex->current_select= lex_select_save;