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.1976 05/08/10 21:17:52 sergefp@stripped +6 -0
Merge mysql.com:/home/psergey/mysql-5.0-bug12228-r4
into mysql.com:/home/psergey/mysql-5.0-bug12228-r5
sql/sql_prepare.cc
1.147 05/08/10 21:17:51 sergefp@stripped +0 -0
Auto merged
sql/sql_parse.cc
1.463 05/08/10 21:17:51 sergefp@stripped +0 -0
Auto merged
sql/sp.cc
1.88 05/08/10 21:17:50 sergefp@stripped +0 -0
Auto merged
mysql-test/t/type_bit.test
1.12 05/08/10 21:17:50 sergefp@stripped +0 -0
Auto merged
mysql-test/t/sp-threads.test
1.7 05/08/10 21:17:50 sergefp@stripped +0 -0
Auto merged
mysql-test/r/type_bit.result
1.13 05/08/10 21:17:50 sergefp@stripped +0 -0
Auto merged
# 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-r5/RESYNC
--- 1.462/sql/sql_parse.cc 2005-08-10 11:01:28 +00:00
+++ 1.463/sql/sql_parse.cc 2005-08-10 21:17:51 +00:00
@@ -5340,11 +5340,12 @@
void mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_ENTER("mysql_parse");
-
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.6/mysql-test/t/sp-threads.test 2005-07-22 01:32:54 +00:00
+++ 1.7/mysql-test/t/sp-threads.test 2005-08-10 21:17:50 +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.87/sql/sp.cc 2005-08-08 23:23:29 +00:00
+++ 1.88/sql/sp.cc 2005-08-10 21:17:50 +00:00
@@ -68,13 +68,16 @@
SYNOPSIS
close_proc_table()
- thd Thread context
+ thd Thread context
+ backup Pointer to Open_tables_state instance which holds
+ information about tables which were open before we
+ decided to access mysql.proc.
*/
-static void close_proc_table(THD *thd)
+void close_proc_table(THD *thd, Open_tables_state *backup)
{
close_thread_tables(thd);
- thd->pop_open_tables_state();
+ thd->restore_backup_open_tables_state(backup);
}
@@ -83,7 +86,10 @@
SYNOPSIS
open_proc_table_for_read()
- thd Thread context
+ thd Thread context
+ backup Pointer to Open_tables_state instance where information about
+ currently open tables will be saved, and from which will be
+ restored when we will end work with mysql.proc.
NOTES
Thanks to restrictions which we put on opening and locking of
@@ -97,11 +103,10 @@
# Pointer to TABLE object of mysql.proc
*/
-static TABLE *open_proc_table_for_read(THD *thd)
+TABLE *open_proc_table_for_read(THD *thd, Open_tables_state *backup)
{
TABLE_LIST tables;
TABLE *table;
- bool old_open_tables= thd->open_tables != 0;
bool refresh;
DBUG_ENTER("open_proc_table");
@@ -112,8 +117,7 @@
if (!mysql_proc_table_exists)
DBUG_RETURN(0);
- if (thd->push_open_tables_state())
- DBUG_RETURN(0);
+ thd->reset_n_backup_open_tables_state(backup);
bzero((char*) &tables, sizeof(tables));
tables.db= (char*) "mysql";
@@ -121,7 +125,7 @@
if (!(table= open_table(thd, &tables, thd->mem_root, &refresh,
MYSQL_LOCK_IGNORE_FLUSH)))
{
- thd->pop_open_tables_state();
+ thd->restore_backup_open_tables_state(backup);
mysql_proc_table_exists= 0;
DBUG_RETURN(0);
}
@@ -130,15 +134,13 @@
table->reginfo.lock_type= TL_READ;
/*
- If we have other tables opened, we have to ensure we are not blocked
- by a flush tables or global read lock, as this could lead to a deadlock
+ We have to ensure we are not blocked by a flush tables, as this
+ could lead to a deadlock if we have other tables opened.
*/
if (!(thd->lock= mysql_lock_tables(thd, &table, 1,
- old_open_tables ?
- (MYSQL_LOCK_IGNORE_GLOBAL_READ_LOCK |
- MYSQL_LOCK_IGNORE_FLUSH) : 0)))
+ MYSQL_LOCK_IGNORE_FLUSH)))
{
- close_proc_table(thd);
+ close_proc_table(thd, backup);
DBUG_RETURN(0);
}
DBUG_RETURN(table);
@@ -271,12 +273,13 @@
char buff[65];
String str(buff, sizeof(buff), &my_charset_bin);
ulong sql_mode;
+ Open_tables_state open_tables_state_backup;
DBUG_ENTER("db_find_routine");
DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str));
*sphp= 0; // In case of errors
- if (!(table= open_proc_table_for_read(thd)))
+ if (!(table= open_proc_table_for_read(thd, &open_tables_state_backup)))
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
if ((ret= db_find_routine_aux(thd, type, name, table)) != SP_OK)
@@ -371,7 +374,7 @@
chistics.comment.str= ptr;
chistics.comment.length= length;
- close_proc_table(thd);
+ close_proc_table(thd, &open_tables_state_backup);
table= 0;
{
@@ -449,7 +452,7 @@
done:
if (table)
- close_proc_table(thd);
+ close_proc_table(thd, &open_tables_state_backup);
DBUG_RETURN(ret);
}
--- 1.12/mysql-test/r/type_bit.result 2005-08-06 00:22:48 +00:00
+++ 1.13/mysql-test/r/type_bit.result 2005-08-10 21:17:50 +00:00
@@ -34,7 +34,7 @@
select 0 + b'1000000000000001';
0 + b'1000000000000001'
32769
-drop table if exists t1;
+drop table if exists t1,t2;
create table t1 (a bit(65));
ERROR 42000: Display width out of range for column 'a' (max = 64)
create table t1 (a bit(0));
--- 1.11/mysql-test/t/type_bit.test 2005-08-08 18:42:06 +00:00
+++ 1.12/mysql-test/t/type_bit.test 2005-08-10 21:17:50 +00:00
@@ -16,7 +16,7 @@
select 0 + b'1000000000000001';
--disable_warnings
-drop table if exists t1;
+drop table if exists t1,t2;
--enable_warnings
--error 1439
--- 1.146/sql/sql_prepare.cc 2005-08-09 07:37:44 +00:00
+++ 1.147/sql/sql_prepare.cc 2005-08-10 21:17:51 +00:00
@@ -73,6 +73,7 @@
#include <m_ctype.h> // for isspace()
#include "sp_head.h"
#include "sp.h"
+#include "sp_cache.h"
#ifdef EMBEDDED_LIBRARY
/* include MYSQL_BIND headers */
#include <mysql.h>
@@ -1783,6 +1784,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);
/*
@@ -2060,6 +2064,8 @@
thd->protocol= stmt->protocol; // 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.1976) | Sergey Petrunia | 10 Aug |