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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e42a24e5
Commit
e42a24e5
authored
Jun 24, 2011
by
Dmitry Shulga
Browse files
Options
Browse Files
Download
Plain Diff
Manual merge of patch for bug#11756013 from mysql-5.1 tree.
parents
7545f866
bc7af175
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
5 deletions
+92
-5
mysql-test/r/sp_sync.result
mysql-test/r/sp_sync.result
+14
-2
mysql-test/t/sp_sync.test
mysql-test/t/sp_sync.test
+27
-2
sql/sp.cc
sql/sp.cc
+48
-1
sql/sql_db.cc
sql/sql_db.cc
+3
-0
No files found.
mysql-test/r/sp_sync.result
View file @
e42a24e5
Tests of syncronization of stored procedure execution.
Tests of sync
h
ronization of stored procedure execution.
SET DEBUG_SYNC= 'RESET';
#
# Bug #30977 Concurrent statement using stored function and
...
...
@@ -92,4 +92,16 @@ COUNT(f1(a))
DROP PROCEDURE p1;
DROP FUNCTION f1;
DROP TABLES t0, t1;
SET DEBUG_SYNC= 'RESET';
#
# test for bug#11756013
#
DROP SCHEMA IF EXISTS s1;
CREATE SCHEMA s1;
CREATE PROCEDURE s1.p1() BEGIN END;
SET DEBUG_SYNC='before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema';
CALL s1.p1;
SET DEBUG_SYNC='now WAIT_FOR check_db';
DROP SCHEMA s1;
SET DEBUG_SYNC='now SIGNAL dropped_schema';
ERROR 42000: Unknown database 's1'
SET DEBUG_SYNC = 'RESET';
mysql-test/t/sp_sync.test
View file @
e42a24e5
# This test should work in embedded server after mysqltest is fixed
--
source
include
/
not_embedded
.
inc
--
echo
Tests
of
syncronization
of
stored
procedure
execution
.
--
echo
Tests
of
sync
h
ronization
of
stored
procedure
execution
.
--
source
include
/
have_debug_sync
.
inc
...
...
@@ -149,9 +149,34 @@ disconnect con2;
DROP
PROCEDURE
p1
;
DROP
FUNCTION
f1
;
DROP
TABLES
t0
,
t1
;
SET
DEBUG_SYNC
=
'RESET'
;
--
echo
#
--
echo
# test for bug#11756013
--
echo
#
--
disable_warnings
DROP
SCHEMA
IF
EXISTS
s1
;
--
enable_warnings
CREATE
SCHEMA
s1
;
CREATE
PROCEDURE
s1
.
p1
()
BEGIN
END
;
connect
(
con3
,
localhost
,
root
);
SET
DEBUG_SYNC
=
'before_db_dir_check SIGNAL check_db WAIT_FOR dropped_schema'
;
--
send
CALL
s1
.
p1
connection
default
;
SET
DEBUG_SYNC
=
'now WAIT_FOR check_db'
;
DROP
SCHEMA
s1
;
SET
DEBUG_SYNC
=
'now SIGNAL dropped_schema'
;
connection
con3
;
--
error
ER_BAD_DB_ERROR
--
reap
connection
default
;
disconnect
con3
;
SET
DEBUG_SYNC
=
'RESET'
;
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--
source
include
/
wait_until_count_sessions
.
inc
sql/sp.cc
View file @
e42a24e5
...
...
@@ -756,6 +756,43 @@ static sp_head *sp_compile(THD *thd, String *defstr, ulong sql_mode,
}
class
Bad_db_error_handler
:
public
Internal_error_handler
{
public:
Bad_db_error_handler
()
:
m_error_caught
(
false
)
{}
virtual
bool
handle_condition
(
THD
*
thd
,
uint
sql_errno
,
const
char
*
sqlstate
,
MYSQL_ERROR
::
enum_warning_level
level
,
const
char
*
message
,
MYSQL_ERROR
**
cond_hdl
);
bool
error_caught
()
const
{
return
m_error_caught
;
}
private:
bool
m_error_caught
;
};
bool
Bad_db_error_handler
::
handle_condition
(
THD
*
thd
,
uint
sql_errno
,
const
char
*
sqlstate
,
MYSQL_ERROR
::
enum_warning_level
level
,
const
char
*
message
,
MYSQL_ERROR
**
cond_hdl
)
{
if
(
sql_errno
==
ER_BAD_DB_ERROR
)
{
m_error_caught
=
true
;
return
true
;
}
return
false
;
}
static
int
db_load_routine
(
THD
*
thd
,
int
type
,
sp_name
*
name
,
sp_head
**
sphp
,
ulong
sql_mode
,
const
char
*
params
,
const
char
*
returns
,
...
...
@@ -769,7 +806,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
LEX_STRING
saved_cur_db_name
=
{
saved_cur_db_name_buf
,
sizeof
(
saved_cur_db_name_buf
)
};
bool
cur_db_changed
;
Bad_db_error_handler
db_not_exists_handler
;
char
definer_user_name_holder
[
USERNAME_LENGTH
+
1
];
LEX_STRING
definer_user_name
=
{
definer_user_name_holder
,
USERNAME_LENGTH
};
...
...
@@ -808,6 +845,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
goto
end
;
}
thd
->
push_internal_handler
(
&
db_not_exists_handler
);
/*
Change the current database (if needed).
...
...
@@ -818,6 +856,15 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
&
cur_db_changed
))
{
ret
=
SP_INTERNAL_ERROR
;
thd
->
pop_internal_handler
();
goto
end
;
}
thd
->
pop_internal_handler
();
if
(
db_not_exists_handler
.
error_caught
())
{
ret
=
SP_INTERNAL_ERROR
;
my_error
(
ER_BAD_DB_ERROR
,
MYF
(
0
),
name
->
m_db
.
str
);
goto
end
;
}
...
...
sql/sql_db.cc
View file @
e42a24e5
...
...
@@ -39,6 +39,7 @@
#ifdef __WIN__
#include <direct.h>
#endif
#include "debug_sync.h"
#define MAX_DROP_TABLE_Q_LEN 1024
...
...
@@ -1536,6 +1537,8 @@ bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name, bool force_switch)
}
#endif
DEBUG_SYNC
(
thd
,
"before_db_dir_check"
);
if
(
check_db_dir_existence
(
new_db_file_name
.
str
))
{
if
(
force_switch
)
...
...
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