Below is the list of changes that have just been committed into a local
5.0 repository of dkatz. When dkatz 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, 2007-06-18 17:55:12-04:00, dkatz@stripped +3 -0
Bug #28921 Queries containing UDF functions are cached
Fixed runtime to no longer allow the caching of queries with UDF calls.
mysql-test/r/udf.result@stripped, 2007-06-18 17:55:07-04:00, dkatz@stripped +23 -0
Added a test that turns on caching and checks that querys calling UDFs don't get cached.
mysql-test/t/udf.test@stripped, 2007-06-18 17:55:07-04:00, dkatz@stripped +24 -0
Added a test that turns on caching and checks that querys calling UDFs don't get cached.
sql/sql_yacc.yy@stripped, 2007-06-18 17:55:08-04:00, dkatz@stripped +2 -2
Fixed code to set safe_to_cache_query=0 regardless if the function call is a UDF or SP. Where it was placed previously -- at the very end of the else testing for UDFs -- it only executed the statement if the function call was a stored procedure call.
# 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: dkatz
# Host: damien-katzs-computer.local
# Root: /Users/dkatz/50_udf_cache
--- 1.523/sql/sql_yacc.yy 2007-06-14 07:37:36 -04:00
+++ 1.524/sql/sql_yacc.yy 2007-06-18 17:55:08 -04:00
@@ -5150,8 +5150,8 @@ simple_expr:
$$= new Item_func_sp(Lex->current_context(), name, *$4);
else
$$= new Item_func_sp(Lex->current_context(), name);
- lex->safe_to_cache_query=0;
- }
+ }
+ lex->safe_to_cache_query=0;
}
| UNIQUE_USERS '(' text_literal ',' NUM ',' NUM ',' expr_list ')'
{
--- 1.12/mysql-test/r/udf.result 2007-03-27 12:31:43 -04:00
+++ 1.13/mysql-test/r/udf.result 2007-06-18 17:55:07 -04:00
@@ -273,4 +273,27 @@ drop function f3;
drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
+CREATE FUNCTION metaphon RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+create table t1 (a char);
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+select metaphon('MySQL') from t1;
+metaphon('MySQL')
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+select metaphon('MySQL') from t1;
+metaphon('MySQL')
+show status like "Qcache_hits";
+Variable_name Value
+Qcache_hits 0
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 0
+drop table t1;
+drop function metaphon;
+set GLOBAL query_cache_size=default;
End of 5.0 tests.
--- 1.12/mysql-test/t/udf.test 2007-01-18 10:33:32 -05:00
+++ 1.13/mysql-test/t/udf.test 2007-06-18 17:55:07 -04:00
@@ -288,4 +288,28 @@ drop function metaphon;
drop function myfunc_double;
drop function myfunc_int;
+#
+# Bug #28921: Queries containing UDF functions are cached
+#
+
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+create table t1 (a char);
+
+set GLOBAL query_cache_size=1355776;
+reset query cache;
+
+select metaphon('MySQL') from t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+
+select metaphon('MySQL') from t1;
+show status like "Qcache_hits";
+show status like "Qcache_queries_in_cache";
+
+drop table t1;
+drop function metaphon;
+set GLOBAL query_cache_size=default;
+
+
--echo End of 5.0 tests.
| Thread |
|---|
| • bk commit into 5.0 tree (dkatz:1.2494) BUG#28921 | damien | 18 Jun |