2725 Sergey Glukhov 2008-12-29
Bug#41131 "Questions" fails to increment - ignores statements instead stored
procs(5.0 ver)
Added global status variable 'Queries' which represents
total amount of queries executed by server including
statements executed by SPs.
note: It's old behaviour of 'Questions' variable.
modified:
mysql-test/r/status.result
mysql-test/t/status.test
sql/mysqld.cc
sql/sql_show.cc
sql/structs.h
2724 Sergey Glukhov 2008-12-24
Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error
Table could be marked dependent because it is
either 1) an inner table of an outer join, or 2) it is a part of
STRAIGHT_JOIN. In case of STRAIGHT_JOIN table->maybe_null should not
be assigned. The fix is to set st_table::maybe_null to 'true' only
for those tables which are used in outer join.
modified:
mysql-test/r/select.result
mysql-test/t/select.test
sql/sql_select.cc
sql/sql_select.h
=== modified file 'mysql-test/r/status.result'
--- a/mysql-test/r/status.result 2007-08-28 15:51:03 +0000
+++ b/mysql-test/r/status.result 2008-12-29 12:06:53 +0000
@@ -91,3 +91,28 @@ SHOW SESSION STATUS LIKE 'Last_query_cos
Variable_name Value
Last_query_cost 4.805836
DROP TABLE t1;
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+DECLARE foo INTEGER;
+DECLARE bar INTEGER;
+SET foo=1;
+SET bar=2;
+RETURN foo;
+END $$
+CREATE PROCEDURE p1()
+BEGIN
+SELECT 1;
+END $$
+SELECT f1();
+f1()
+1
+CALL p1();
+1
+1
+SELECT 9;
+9
+9
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
=== modified file 'mysql-test/t/status.test'
--- a/mysql-test/t/status.test 2007-08-28 15:51:03 +0000
+++ b/mysql-test/t/status.test 2008-12-29 12:06:53 +0000
@@ -171,4 +171,40 @@ SHOW SESSION STATUS LIKE 'Last_query_cos
DROP TABLE t1;
+#
+# Bug#41131 "Questions" fails to increment - ignores statements instead stored procs
+#
+connect (con1,localhost,root,,);
+connection con1;
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+DROP FUNCTION IF EXISTS f1;
+--enable_warnings
+DELIMITER $$;
+CREATE FUNCTION f1() RETURNS INTEGER
+BEGIN
+ DECLARE foo INTEGER;
+ DECLARE bar INTEGER;
+ SET foo=1;
+ SET bar=2;
+ RETURN foo;
+END $$
+CREATE PROCEDURE p1()
+ BEGIN
+ SELECT 1;
+END $$
+DELIMITER ;$$
+let $org_queries= `SHOW STATUS LIKE 'Queries'`;
+SELECT f1();
+CALL p1();
+let $new_queries= `SHOW STATUS LIKE 'Queries'`;
+--disable_log
+let $diff= `SELECT SUBSTRING('$new_queries',9)-SUBSTRING('$org_queries',9)`;
+--enable_log
+eval SELECT $diff;
+disconnect con1;
+connection default;
+DROP PROCEDURE p1;
+DROP FUNCTION f1;
+
# End of 5.0 tests
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-12-24 14:45:47 +0000
+++ b/sql/mysqld.cc 2008-12-29 12:06:53 +0000
@@ -6620,6 +6620,7 @@ struct show_var_st status_vars[]= {
{"Qcache_queries_in_cache", (char*) &query_cache.queries_in_cache,
SHOW_LONG_CONST},
{"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_CONST},
#endif /*HAVE_QUERY_CACHE*/
+ {"Queries", (char*) 0, SHOW_QUERIES},
{"Questions", (char*) offsetof(STATUS_VAR, questions),
SHOW_LONG_STATUS},
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2008-12-24 15:01:41 +0000
+++ b/sql/sql_show.cc 2008-12-29 12:06:53 +0000
@@ -1543,6 +1543,9 @@ static bool show_status_array(THD *thd,
nr= (long) (thd->query_start() - server_start_time);
end= int10_to_str(nr, buff, 10);
break;
+ case SHOW_QUERIES:
+ end= int10_to_str((long) thd->query_id, buff, 10);
+ break;
#ifdef HAVE_REPLICATION
case SHOW_RPL_STATUS:
end= strmov(buff, rpl_status_type[(int)rpl_status]);
=== modified file 'sql/structs.h'
--- a/sql/structs.h 2008-10-09 07:26:42 +0000
+++ b/sql/structs.h 2008-12-29 12:06:53 +0000
@@ -170,7 +170,7 @@ enum SHOW_TYPE
SHOW_UNDEF,
SHOW_LONG, SHOW_LONGLONG, SHOW_INT, SHOW_CHAR, SHOW_CHAR_PTR,
SHOW_DOUBLE_STATUS,
- SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME,
+ SHOW_BOOL, SHOW_MY_BOOL, SHOW_OPENTABLES, SHOW_STARTTIME, SHOW_QUERIES,
SHOW_LONG_CONST, SHOW_INT_CONST, SHOW_HAVE, SHOW_SYS, SHOW_HA_ROWS,
SHOW_VARS,
#ifdef HAVE_OPENSSL
| Thread |
|---|
| • bzr push into mysql-5.0-bugteam branch (Sergey.Glukhov:2724 to 2725)Bug#41131 | Sergey Glukhov | 29 Dec |