Below is the list of changes that have just been committed into a local
5.0 repository of psergey. When psergey 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.1953 05/08/10 21:17:02 sergefp@stripped +6 -0
BUG#12228: Post review fixes: Added test case, code cleanup.
sql/sql_prepare.cc
1.146 05/08/10 21:16:58 sergefp@stripped +5 -4
BUG#12228: Post-review fixes: in mysql_stmt_prepare/execute, flush SP caches
"closer to the execution"
sql/sql_parse.cc
1.459 05/08/10 21:16:58 sergefp@stripped +2 -2
BUG#12228: Post-review fixes: in mysql_parse, flush obsolete SPs from the caches only if
the query hasn't been handled by the query cache.
sql/sp_cache.h
1.13 05/08/10 21:16:58 sergefp@stripped +1 -1
BUG#12228: Post-review fixes: fixed the comment
sql/sp_cache.cc
1.13 05/08/10 21:16:58 sergefp@stripped +3 -7
BUG#12228: Post-review fixes: small code cleanup
mysql-test/t/sp-threads.test
1.6 05/08/10 21:16:58 sergefp@stripped +43 -0
Testcase for BUG#12228
mysql-test/r/sp-threads.result
1.6 05/08/10 21:16:58 sergefp@stripped +25 -0
Testcase for BUG#12228
# 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: sergefp
# Host: newbox.mylan
# Root: /home/psergey/mysql-5.0-bug12228-r4
--- 1.458/sql/sql_parse.cc 2005-08-08 23:23:29 +00:00
+++ 1.459/sql/sql_parse.cc 2005-08-10 21:16:58 +00:00
@@ -5347,12 +5347,12 @@
void mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_ENTER("mysql_parse");
- sp_cache_flush_obsolete(&thd->sp_proc_cache);
- sp_cache_flush_obsolete(&thd->sp_func_cache);
mysql_init_query(thd, (uchar*) inBuf, length);
if (query_cache_send_result_to_client(thd, inBuf, length) <= 0)
{
LEX *lex= thd->lex;
+ sp_cache_flush_obsolete(&thd->sp_proc_cache);
+ sp_cache_flush_obsolete(&thd->sp_func_cache);
if (!yyparse((void *)thd) && ! thd->is_fatal_error)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
--- 1.5/mysql-test/r/sp-threads.result 2005-07-30 08:19:50 +00:00
+++ 1.6/mysql-test/r/sp-threads.result 2005-08-10 21:16:58 +00:00
@@ -37,6 +37,7 @@
# root localhost test Sleep # NULL
# root localhost test Query # Locked update t1, t2 set val= 1 where id1=id2
# root localhost test Query # NULL show processlist
+# root localhost test Sleep # NULL
unlock tables;
drop procedure bug9486;
drop table t1, t2;
@@ -64,3 +65,27 @@
drop function bug11554;
drop table t1;
drop view v1;
+drop procedure if exists p1;
+drop procedure if exists p2;
+create table t1 (s1 int)|
+create procedure p1() select * from t1|
+create procedure p2()
+begin
+insert into t1 values (1);
+call p1();
+select * from t1;
+end|
+use test;
+lock table t1 write;
+ call p2();
+use test;
+drop procedure p1;
+create procedure p1() select * from t1;
+unlock tables;
+s1
+1
+s1
+1
+drop procedure p1;
+drop procedure p2;
+drop table t1;
--- 1.5/mysql-test/t/sp-threads.test 2005-07-13 09:48:02 +00:00
+++ 1.6/mysql-test/t/sp-threads.test 2005-08-10 21:16:58 +00:00
@@ -5,6 +5,7 @@
connect (con1root,localhost,root,,);
connect (con2root,localhost,root,,);
+connect (con3root,localhost,root,,);
connection con1root;
use test;
@@ -129,6 +130,48 @@
drop function bug11554;
drop table t1;
drop view v1;
+
+
+# BUG#12228
+--disable_warnings
+drop procedure if exists p1;
+drop procedure if exists p2;
+--enable_warnings
+
+connection con1root;
+delimiter |;
+create table t1 (s1 int)|
+create procedure p1() select * from t1|
+create procedure p2()
+begin
+ insert into t1 values (1);
+ call p1();
+ select * from t1;
+end|
+delimiter ;|
+
+connection con2root;
+use test;
+lock table t1 write;
+
+connection con1root;
+send call p2();
+
+connection con3root;
+use test;
+drop procedure p1;
+create procedure p1() select * from t1;
+
+connection con2root;
+unlock tables;
+
+connection con1root;
+# Crash will be here if we hit BUG#12228
+reap;
+
+drop procedure p1;
+drop procedure p2;
+drop table t1;
#
# BUG#NNNN: New bug synopsis
--- 1.12/sql/sp_cache.cc 2005-08-09 10:09:07 +00:00
+++ 1.13/sql/sp_cache.cc 2005-08-10 21:16:58 +00:00
@@ -122,19 +122,15 @@
{
sp_cache *c= *cp;
- if (! c)
+ if (!c && (c= new sp_cache()))
{
- ulong v;
- c= new sp_cache();
pthread_mutex_lock(&Cversion_lock); // LOCK
- v= Cversion;
+ c->version= Cversion;
pthread_mutex_unlock(&Cversion_lock); // UNLOCK
- if (c)
- c->version= v;
}
if (c)
{
- DBUG_PRINT("info",("sp_cache: inserting: %*s", sp->m_qname.length,
+ DBUG_PRINT("info",("sp_cache: inserting: %*s", sp->m_qname.length,
sp->m_qname.str));
c->insert(sp);
if (*cp == NULL)
--- 1.12/sql/sp_cache.h 2005-08-08 23:23:29 +00:00
+++ 1.13/sql/sp_cache.h 2005-08-10 21:16:58 +00:00
@@ -46,7 +46,7 @@
sp_cache_insert();
sp_cache_invalidate();
- 2.2 When not holding any sp_head* pointers (at query end):
+ 2.2 When not holding any sp_head* pointers:
sp_cache_flush_obsolete();
3. Before thread exit:
--- 1.145/sql/sql_prepare.cc 2005-08-08 23:23:30 +00:00
+++ 1.146/sql/sql_prepare.cc 2005-08-10 21:16:58 +00:00
@@ -1730,8 +1730,6 @@
DBUG_ENTER("mysql_stmt_prepare");
DBUG_PRINT("prep_query", ("%s", packet));
- sp_cache_flush_obsolete(&thd->sp_proc_cache);
- sp_cache_flush_obsolete(&thd->sp_func_cache);
/*
If this is an SQLCOM_PREPARE, we also increase Com_prepare_sql.
@@ -1785,6 +1783,9 @@
lex= thd->lex;
lex->safe_to_cache_query= 0;
+ sp_cache_flush_obsolete(&thd->sp_proc_cache);
+ sp_cache_flush_obsolete(&thd->sp_func_cache);
+
error= yyparse((void *)thd) || thd->is_fatal_error ||
thd->net.report_error || init_param_array(stmt);
/*
@@ -1981,8 +1982,6 @@
Prepared_statement *stmt;
DBUG_ENTER("mysql_stmt_execute");
- sp_cache_flush_obsolete(&thd->sp_proc_cache);
- sp_cache_flush_obsolete(&thd->sp_func_cache);
packet+= 9; /* stmt_id + 5 bytes of flags */
statistic_increment(thd->status_var.com_stmt_execute, &LOCK_status);
@@ -2063,6 +2062,8 @@
thd->protocol= &thd->protocol_prep; // Switch to binary protocol
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(),QUERY_PRIOR);
+ sp_cache_flush_obsolete(&thd->sp_proc_cache);
+ sp_cache_flush_obsolete(&thd->sp_func_cache);
mysql_execute_command(thd);
if (!(specialflag & SPECIAL_NO_PRIOR))
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
| Thread |
|---|
| • bk commit into 5.0 tree (sergefp:1.1953) BUG#12228 | Sergey Petrunia | 10 Aug |