Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fbab5fc5
Commit
fbab5fc5
authored
Aug 10, 2005
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#12228: Post review fixes: Added test case, code cleanup.
parent
b7474403
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
14 deletions
+79
-14
mysql-test/r/sp-threads.result
mysql-test/r/sp-threads.result
+25
-0
mysql-test/t/sp-threads.test
mysql-test/t/sp-threads.test
+43
-0
sql/sp_cache.cc
sql/sp_cache.cc
+3
-7
sql/sp_cache.h
sql/sp_cache.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
sql/sql_prepare.cc
sql/sql_prepare.cc
+5
-4
No files found.
mysql-test/r/sp-threads.result
View file @
fbab5fc5
...
...
@@ -37,6 +37,7 @@ Id User Host db Command Time State Info
# 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 @@ insert into t1 (select f from v1);
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;
mysql-test/t/sp-threads.test
View file @
fbab5fc5
...
...
@@ -5,6 +5,7 @@
connect
(
con1root
,
localhost
,
root
,,);
connect
(
con2root
,
localhost
,
root
,,);
connect
(
con3root
,
localhost
,
root
,,);
connection
con1root
;
use
test
;
...
...
@@ -130,6 +131,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
#
...
...
sql/sp_cache.cc
View file @
fbab5fc5
...
...
@@ -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
)
...
...
sql/sp_cache.h
View file @
fbab5fc5
...
...
@@ -46,7 +46,7 @@ class sp_cache;
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:
...
...
sql/sql_parse.cc
View file @
fbab5fc5
...
...
@@ -5347,12 +5347,12 @@ void mysql_init_multi_delete(LEX *lex)
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
...
...
sql/sql_prepare.cc
View file @
fbab5fc5
...
...
@@ -1730,8 +1730,6 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
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 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
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 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
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 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment