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
806b5468
Commit
806b5468
authored
Aug 08, 2005
by
ingo@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/mydev/mysql-4.1-4100
into mysql.com:/home/mydev/mysql-5.0-5000
parents
b3eed0e4
fd946d42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
0 deletions
+69
-0
mysql-test/r/flush.result
mysql-test/r/flush.result
+21
-0
mysql-test/t/flush.test
mysql-test/t/flush.test
+31
-0
sql/sql_parse.cc
sql/sql_parse.cc
+17
-0
No files found.
mysql-test/r/flush.result
View file @
806b5468
...
...
@@ -27,3 +27,24 @@ select * from t1;
n
345
drop table t1;
create table t1 (c1 int);
lock table t1 write;
flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
lock table t1 read;
flush tables with read lock;
lock table t1 write;
ERROR HY000: Can't execute the query because you have a conflicting read lock
lock table t1 read;
lock table t1 write;
ERROR HY000: Can't execute the query because you have a conflicting read lock
unlock tables;
create table t2 (c1 int);
create table t3 (c1 int);
lock table t1 read, t2 read, t3 write;
flush tables with read lock;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
lock table t1 read, t2 read, t3 read;
flush tables with read lock;
unlock tables;
drop table t1, t2, t3;
mysql-test/t/flush.test
View file @
806b5468
...
...
@@ -70,4 +70,35 @@ insert into t1 values (345);
select
*
from
t1
;
drop
table
t1
;
#
# Bug#9459 - deadlock with flush with lock, and lock table write
#
create
table
t1
(
c1
int
);
lock
table
t1
write
;
# Cannot get the global read lock with write locked tables.
--
error
1192
flush
tables
with
read
lock
;
lock
table
t1
read
;
# Can get the global read lock with read locked tables.
flush
tables
with
read
lock
;
--
error
1223
lock
table
t1
write
;
lock
table
t1
read
;
--
error
1223
lock
table
t1
write
;
# Release all table locks and the global read lock.
unlock
tables
;
create
table
t2
(
c1
int
);
create
table
t3
(
c1
int
);
lock
table
t1
read
,
t2
read
,
t3
write
;
# Cannot get the global read lock with write locked tables.
--
error
1192
flush
tables
with
read
lock
;
lock
table
t1
read
,
t2
read
,
t3
read
;
# Can get the global read lock with read locked tables.
flush
tables
with
read
lock
;
# Release all table locks and the global read lock.
unlock
tables
;
drop
table
t1
,
t2
,
t3
;
# End of 4.1 tests
sql/sql_parse.cc
View file @
806b5468
...
...
@@ -6449,6 +6449,23 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
{
if
((
options
&
REFRESH_READ_LOCK
)
&&
thd
)
{
/*
We must not try to aspire a global read lock if we have a write
locked table. This would lead to a deadlock when trying to
reopen (and re-lock) the table after the flush.
*/
if
(
thd
->
locked_tables
)
{
THR_LOCK_DATA
**
lock_p
=
thd
->
locked_tables
->
locks
;
THR_LOCK_DATA
**
end_p
=
lock_p
+
thd
->
locked_tables
->
lock_count
;
for
(;
lock_p
<
end_p
;
lock_p
++
)
if
((
*
lock_p
)
->
type
==
TL_WRITE
)
{
my_error
(
ER_LOCK_OR_ACTIVE_TRANSACTION
,
MYF
(
0
));
return
1
;
}
}
/*
Writing to the binlog could cause deadlocks, as we don't log
UNLOCK TABLES
...
...
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