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
cb7078f5
Commit
cb7078f5
authored
Feb 15, 2010
by
Alexander Nozdrin
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge from mysql-next-4284.
parents
fe8d83a1
be3e256d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
185 additions
and
4 deletions
+185
-4
mysql-test/include/handler.inc
mysql-test/include/handler.inc
+22
-0
mysql-test/r/flush.result
mysql-test/r/flush.result
+17
-0
mysql-test/r/handler_innodb.result
mysql-test/r/handler_innodb.result
+18
-0
mysql-test/r/handler_myisam.result
mysql-test/r/handler_myisam.result
+18
-0
mysql-test/r/lock_multi.result
mysql-test/r/lock_multi.result
+26
-0
mysql-test/t/flush.test
mysql-test/t/flush.test
+21
-0
mysql-test/t/lock_multi.test
mysql-test/t/lock_multi.test
+54
-0
sql/mdl.cc
sql/mdl.cc
+8
-3
sql/mdl.h
sql/mdl.h
+1
-1
No files found.
mysql-test/include/handler.inc
View file @
cb7078f5
...
...
@@ -1681,3 +1681,25 @@ handler t1 close;
--
echo
# Clean-up.
drop
function
f1
;
drop
tables
t1
,
t2
;
--
echo
#
--
echo
# Test for bug #51136 "Crash in pthread_rwlock_rdlock on TEMPORARY +
--
echo
# HANDLER + LOCK + SP".
--
echo
# Also see additional coverage for this bug in flush.test.
--
echo
#
--
disable_warnings
drop
tables
if
exists
t1
,
t2
;
--
enable_warnings
create
table
t1
(
i
int
);
create
temporary
table
t2
(
j
int
);
handler
t1
open
;
lock
table
t2
read
;
--
echo
# This commit should not release any MDL locks.
commit
;
unlock
tables
;
--
echo
# The below statement crashed before the bug fix as it
--
echo
# has attempted to release metadata lock which was
--
echo
# already released by commit.
handler
t1
close
;
drop
tables
t1
,
t2
;
mysql-test/r/flush.result
View file @
cb7078f5
...
...
@@ -94,3 +94,20 @@ unlock tables;
set global general_log= @old_general_log;
set global read_only= @old_read_only;
End of 5.1 tests
#
# Additional test for bug #51136 "Crash in pthread_rwlock_rdlock
# on TEMPORARY + HANDLER + LOCK + SP".
# Also see the main test for this bug in include/handler.inc.
#
drop tables if exists t1, t2;
create table t1 (i int);
create temporary table t2 (j int);
flush tables with read lock;
lock table t2 read;
# This commit should not release any MDL locks.
commit;
# The below statement crashed before the bug fix as it
# has attempted to release global shared metadata lock
# which was already released by commit.
unlock tables;
drop tables t1, t2;
mysql-test/r/handler_innodb.result
View file @
cb7078f5
...
...
@@ -1667,3 +1667,21 @@ handler t1 close;
# Clean-up.
drop function f1;
drop tables t1, t2;
#
# Test for bug #51136 "Crash in pthread_rwlock_rdlock on TEMPORARY +
# HANDLER + LOCK + SP".
# Also see additional coverage for this bug in flush.test.
#
drop tables if exists t1, t2;
create table t1 (i int);
create temporary table t2 (j int);
handler t1 open;
lock table t2 read;
# This commit should not release any MDL locks.
commit;
unlock tables;
# The below statement crashed before the bug fix as it
# has attempted to release metadata lock which was
# already released by commit.
handler t1 close;
drop tables t1, t2;
mysql-test/r/handler_myisam.result
View file @
cb7078f5
...
...
@@ -1664,6 +1664,24 @@ handler t1 close;
drop function f1;
drop tables t1, t2;
#
# Test for bug #51136 "Crash in pthread_rwlock_rdlock on TEMPORARY +
# HANDLER + LOCK + SP".
# Also see additional coverage for this bug in flush.test.
#
drop tables if exists t1, t2;
create table t1 (i int);
create temporary table t2 (j int);
handler t1 open;
lock table t2 read;
# This commit should not release any MDL locks.
commit;
unlock tables;
# The below statement crashed before the bug fix as it
# has attempted to release metadata lock which was
# already released by commit.
handler t1 close;
drop tables t1, t2;
#
# BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
#
CREATE TABLE t1 AS SELECT 1 AS f1;
...
...
mysql-test/r/lock_multi.result
View file @
cb7078f5
...
...
@@ -436,3 +436,29 @@ UNLOCK TABLES;
# Reaping: DROP TABLE t1, t2
# Connection default
# Cleanup
#
# Test for bug #51134 "Crash in MDL_lock::destroy on a concurrent
# DDL workload".
#
drop tables if exists t1, t2, t3;
create table t3 (i int);
# Switching to connection 'con1'
# Lock 't3' so upcoming RENAME is blocked.
lock table t3 read;
# Switching to connection 'con2'
# Remember ID for this connection.
# Start statement which will try to acquire two instances
# of X metadata lock on the same object.
# Sending:
rename tables t1 to t2, t2 to t3;;
# Switching to connection 'default'
# Wait until RENAME TABLE is blocked on table 't3'.
# Kill RENAME TABLE.
kill query ID;
# Switching to connection 'con2'
# RENAME TABLE should be aborted but should not crash.
ERROR 70100: Query execution was interrupted
# Switching to connection 'con1'
unlock tables;
# Switching to connection 'default'
drop table t3;
mysql-test/t/flush.test
View file @
cb7078f5
...
...
@@ -203,3 +203,24 @@ set global general_log= @old_general_log;
set
global
read_only
=
@
old_read_only
;
--
echo
End
of
5.1
tests
--
echo
#
--
echo
# Additional test for bug #51136 "Crash in pthread_rwlock_rdlock
--
echo
# on TEMPORARY + HANDLER + LOCK + SP".
--
echo
# Also see the main test for this bug in include/handler.inc.
--
echo
#
--
disable_warnings
drop
tables
if
exists
t1
,
t2
;
--
enable_warnings
create
table
t1
(
i
int
);
create
temporary
table
t2
(
j
int
);
flush
tables
with
read
lock
;
lock
table
t2
read
;
--
echo
# This commit should not release any MDL locks.
commit
;
--
echo
# The below statement crashed before the bug fix as it
--
echo
# has attempted to release global shared metadata lock
--
echo
# which was already released by commit.
unlock
tables
;
drop
tables
t1
,
t2
;
mysql-test/t/lock_multi.test
View file @
cb7078f5
...
...
@@ -1038,5 +1038,59 @@ disconnect con2;
disconnect
con3
;
--
echo
#
--
echo
# Test for bug #51134 "Crash in MDL_lock::destroy on a concurrent
--
echo
# DDL workload".
--
echo
#
--
disable_warnings
drop
tables
if
exists
t1
,
t2
,
t3
;
--
enable_warnings
connect
(
con1
,
localhost
,
root
,
,
);
connect
(
con2
,
localhost
,
root
,
,
);
connection
default
;
create
table
t3
(
i
int
);
--
echo
# Switching to connection 'con1'
connection
con1
;
--
echo
# Lock 't3' so upcoming RENAME is blocked.
lock
table
t3
read
;
--
echo
# Switching to connection 'con2'
connection
con2
;
--
echo
# Remember ID for this connection.
let
$ID
=
`select connection_id()`
;
--
echo
# Start statement which will try to acquire two instances
--
echo
# of X metadata lock on the same object.
--
echo
# Sending:
--
send
rename
tables
t1
to
t2
,
t2
to
t3
;
--
echo
# Switching to connection 'default'
connection
default
;
--
echo
# Wait until RENAME TABLE is blocked on table 't3'.
let
$wait_condition
=
select
count
(
*
)
=
1
from
information_schema
.
processlist
where
state
=
"Waiting for table"
and
info
=
"rename tables t1 to t2, t2 to t3"
;
--
source
include
/
wait_condition
.
inc
--
echo
# Kill RENAME TABLE.
--
replace_result
$ID
ID
eval
kill
query
$ID
;
--
echo
# Switching to connection 'con2'
connection
con2
;
--
echo
# RENAME TABLE should be aborted but should not crash.
--
error
ER_QUERY_INTERRUPTED
--
reap
--
echo
# Switching to connection 'con1'
connection
con1
;
unlock
tables
;
--
echo
# Switching to connection 'default'
connection
default
;
disconnect
con1
;
disconnect
con2
;
drop
table
t3
;
# Wait till all disconnects are completed
--
source
include
/
wait_until_count_sessions
.
inc
sql/mdl.cc
View file @
cb7078f5
...
...
@@ -1532,6 +1532,7 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests,
{
MDL_request_list
::
Iterator
it
(
*
mdl_requests
);
MDL_request
**
sort_buf
,
**
p_req
;
MDL_ticket
*
mdl_svp
=
mdl_savepoint
();
ssize_t
req_count
=
static_cast
<
ssize_t
>
(
mdl_requests
->
elements
());
if
(
req_count
==
0
)
...
...
@@ -1565,12 +1566,16 @@ bool MDL_context::acquire_locks(MDL_request_list *mdl_requests,
return
FALSE
;
err:
/* Release locks we have managed to acquire so far. */
/*
Release locks we have managed to acquire so far.
Use rollback_to_savepoint() since there may be duplicate
requests that got assigned the same ticket.
*/
rollback_to_savepoint
(
mdl_svp
);
/* Reset lock requests back to its initial state. */
for
(
req_count
=
p_req
-
sort_buf
,
p_req
=
sort_buf
;
p_req
<
sort_buf
+
req_count
;
p_req
++
)
{
release_lock
((
*
p_req
)
->
ticket
);
/* Reset lock request back to its initial state. */
(
*
p_req
)
->
ticket
=
NULL
;
}
my_free
(
sort_buf
,
MYF
(
0
));
...
...
sql/mdl.h
View file @
cb7078f5
...
...
@@ -501,7 +501,7 @@ public:
void
set_trans_sentinel
()
{
m_trans_sentinel
=
m
dl_savepoi
nt
();
m_trans_sentinel
=
m
_tickets
.
fro
nt
();
}
MDL_ticket
*
trans_sentinel
()
const
{
return
m_trans_sentinel
;
}
...
...
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