BUG#12228: Post review fixes: Added test case, code cleanup.

mysql-test/r/sp-threads.result:
  Testcase for BUG#12228
mysql-test/t/sp-threads.test:
  Testcase for BUG#12228
sql/sp_cache.cc:
  BUG#12228: Post-review fixes: small code cleanup
sql/sp_cache.h:
  BUG#12228: Post-review fixes: fixed the comment
sql/sql_parse.cc:
  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/sql_prepare.cc:
  BUG#12228: Post-review fixes: in mysql_stmt_prepare/execute, flush SP caches 
   "closer to the execution"
This commit is contained in:
unknown 2005-08-10 21:17:02 +00:00
commit 6b9ec78be0
6 changed files with 79 additions and 14 deletions

View file

@ -122,19 +122,15 @@ void sp_cache_insert(sp_cache **cp, sp_head *sp)
{
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)