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
22f62e8a
Commit
22f62e8a
authored
Jan 16, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0-runtime
into mockturtle.local:/home/dlenev/src/mysql-5.0-bg20390-2
parents
f71b6a84
96e5be8c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
79 additions
and
6 deletions
+79
-6
mysql-test/r/ndb_lock.result
mysql-test/r/ndb_lock.result
+35
-0
mysql-test/t/ndb_lock.test
mysql-test/t/ndb_lock.test
+43
-6
sql/sql_select.cc
sql/sql_select.cc
+1
-0
No files found.
mysql-test/r/ndb_lock.result
View file @
22f62e8a
...
@@ -87,11 +87,27 @@ x y z
...
@@ -87,11 +87,27 @@ x y z
rollback;
rollback;
commit;
commit;
begin;
begin;
select * from t1 where y = 'one' or y = 'three' for update;
x y z
# # #
# # #
begin;
select * from t1 where x = 2 for update;
x y z
2 two 2
select * from t1 where x = 1 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
commit;
begin;
select * from t1 where y = 'one' or y = 'three' order by x for update;
select * from t1 where y = 'one' or y = 'three' order by x for update;
x y z
x y z
1 one 1
1 one 1
3 three 3
3 three 3
begin;
begin;
select * from t1 where x = 2 for update;
x y z
2 two 2
select * from t1 where x = 1 for update;
select * from t1 where x = 1 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
rollback;
...
@@ -124,6 +140,22 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
...
@@ -124,6 +140,22 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
rollback;
commit;
commit;
begin;
begin;
select * from t1 where y = 'one' or y = 'three' lock in share mode;
x y z
# # #
# # #
begin;
select * from t1 where y = 'one' lock in share mode;
x y z
1 one 1
select * from t1 where x = 2 for update;
x y z
2 two 2
select * from t1 where x = 1 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
commit;
begin;
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
select * from t1 where y = 'one' or y = 'three' order by x lock in share mode;
x y z
x y z
1 one 1
1 one 1
...
@@ -132,6 +164,9 @@ begin;
...
@@ -132,6 +164,9 @@ begin;
select * from t1 where y = 'one' lock in share mode;
select * from t1 where y = 'one' lock in share mode;
x y z
x y z
1 one 1
1 one 1
select * from t1 where x = 2 for update;
x y z
2 two 2
select * from t1 where x = 1 for update;
select * from t1 where x = 1 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
rollback;
...
...
mysql-test/t/ndb_lock.test
View file @
22f62e8a
...
@@ -102,16 +102,36 @@ connection con1;
...
@@ -102,16 +102,36 @@ connection con1;
commit
;
commit
;
# table scan
# table scan
#
# Note that there are two distinct execution paths in which we unlock
# non-matching rows inspected during table scan - one that is used in
# case of filesort and one that used in rest of cases. Below we cover
# the latter (Bug #20390 "SELECT FOR UPDATE does not release locks of
# untouched rows in full table scans").
connection
con1
;
connection
con1
;
begin
;
begin
;
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
order
by
x
for
update
;
# We can't use "order by x" here as it will cause filesort
--
replace_column
1
# 2 # 3 #
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
for
update
;
connection
con2
;
connection
con2
;
begin
;
begin
;
# Have to check with pk access here since scans take locks on
# Have to check with pk access here since scans take locks on
# all rows and then release them in chunks
# all rows and then release them in chunks
# Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans
select
*
from
t1
where
x
=
2
for
update
;
#select * from t1 where x = 2 for update;
--
error
1205
select
*
from
t1
where
x
=
1
for
update
;
rollback
;
connection
con1
;
commit
;
# And now the test for case with filesort
begin
;
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
order
by
x
for
update
;
connection
con2
;
begin
;
select
*
from
t1
where
x
=
2
for
update
;
--
error
1205
--
error
1205
select
*
from
t1
where
x
=
1
for
update
;
select
*
from
t1
where
x
=
1
for
update
;
rollback
;
rollback
;
...
@@ -157,15 +177,32 @@ commit;
...
@@ -157,15 +177,32 @@ commit;
# table scan
# table scan
connection
con1
;
connection
con1
;
begin
;
begin
;
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
order
by
x
lock
in
share
mode
;
# We can't use "order by x" here as it will cause filesort
--
replace_column
1
# 2 # 3 #
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
lock
in
share
mode
;
connection
con2
;
connection
con2
;
begin
;
begin
;
select
*
from
t1
where
y
=
'one'
lock
in
share
mode
;
select
*
from
t1
where
y
=
'one'
lock
in
share
mode
;
# Have to check with pk access here since scans take locks on
# Have to check with pk access here since scans take locks on
# all rows and then release them in chunks
# all rows and then release them in chunks
# Bug #20390 SELECT FOR UPDATE does not release locks of untouched rows in full table scans
select
*
from
t1
where
x
=
2
for
update
;
#select * from t1 where x = 2 for update;
--
error
1205
select
*
from
t1
where
x
=
1
for
update
;
rollback
;
connection
con1
;
commit
;
# And the same test for case with filesort
connection
con1
;
begin
;
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
order
by
x
lock
in
share
mode
;
connection
con2
;
begin
;
select
*
from
t1
where
y
=
'one'
lock
in
share
mode
;
select
*
from
t1
where
x
=
2
for
update
;
--
error
1205
--
error
1205
select
*
from
t1
where
x
=
1
for
update
;
select
*
from
t1
where
x
=
1
for
update
;
rollback
;
rollback
;
...
...
sql/sql_select.cc
View file @
22f62e8a
...
@@ -10434,6 +10434,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
...
@@ -10434,6 +10434,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
*/
*/
join
->
examined_rows
++
;
join
->
examined_rows
++
;
join
->
thd
->
row_count
++
;
join
->
thd
->
row_count
++
;
join_tab
->
read_record
.
file
->
unlock_row
();
}
}
return
NESTED_LOOP_OK
;
return
NESTED_LOOP_OK
;
}
}
...
...
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