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
edb4b13c
Commit
edb4b13c
authored
Jun 12, 2006
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added lock test on index scan
parent
cb33361f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
28 deletions
+90
-28
mysql-test/r/ndb_lock.result
mysql-test/r/ndb_lock.result
+51
-24
mysql-test/t/ndb_lock.test
mysql-test/t/ndb_lock.test
+39
-4
No files found.
mysql-test/r/ndb_lock.result
View file @
edb4b13c
...
...
@@ -63,62 +63,89 @@ pk u o
5 5 5
insert into t1 values (1,1,1);
drop table t1;
create table t1 (x integer not null primary key, y varchar(32)) engine = ndb;
insert into t1 values (1,'one'
), (2,'two'),(3,"three"
);
create table t1 (x integer not null primary key, y varchar(32)
, z integer, key(z)
) engine = ndb;
insert into t1 values (1,'one'
,1), (2,'two',2),(3,"three",3
);
begin;
select * from t1 where x = 1 for update;
x y
1 one
x y
z
1 one
1
begin;
select * from t1 where x = 2 for update;
x y
2 two
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' for update;
x y
3 three
1 one
x y
z
3 three
3
1 one
1
begin;
select * from t1 where x = 2 for update;
x y
2 two
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 z > 1 and z < 3 for update;
x y z
2 two 2
begin;
select * from t1 where x = 1 for update;
x y z
1 one 1
select * from t1 where x = 2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
commit;
begin;
select * from t1 where x = 1 lock in share mode;
x y
1 one
x y
z
1 one
1
begin;
select * from t1 where x = 1 lock in share mode;
x y
1 one
x y
z
1 one
1
select * from t1 where x = 2 for update;
x y
2 two
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' lock in share mode;
x y
3 three
1 one
x y
z
3 three
3
1 one
1
begin;
select * from t1 where y = 'one' lock in share mode;
x y
1 one
x y
z
1 one
1
select * from t1 where x = 2 for update;
x y
2 two
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 z > 1 and z < 3 lock in share mode;
x y z
2 two 2
begin;
select * from t1 where z = 1 lock in share mode;
x y z
1 one 1
select * from t1 where x = 1 for update;
x y z
1 one 1
select * from t1 where x = 2 for update;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
rollback;
commit;
drop table t1;
mysql-test/t/ndb_lock.test
View file @
edb4b13c
...
...
@@ -71,9 +71,9 @@ drop table t1;
# Lock for update
create
table
t1
(
x
integer
not
null
primary
key
,
y
varchar
(
32
))
engine
=
ndb
;
create
table
t1
(
x
integer
not
null
primary
key
,
y
varchar
(
32
)
,
z
integer
,
key
(
z
)
)
engine
=
ndb
;
insert
into
t1
values
(
1
,
'one'
),
(
2
,
'two'
),(
3
,
"three"
);
insert
into
t1
values
(
1
,
'one'
,
1
),
(
2
,
'two'
,
2
),(
3
,
"three"
,
3
);
# PK access
connection
con1
;
...
...
@@ -90,7 +90,7 @@ rollback;
connection
con1
;
commit
;
# scan
#
table
scan
connection
con1
;
begin
;
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
for
update
;
...
...
@@ -107,6 +107,23 @@ rollback;
connection
con1
;
commit
;
# index scan
connection
con1
;
begin
;
select
*
from
t1
where
z
>
1
and
z
<
3
for
update
;
connection
con2
;
begin
;
# Have to check with pk access here since scans take locks on
# all rows and then release them in chunks
select
*
from
t1
where
x
=
1
for
update
;
--
error
1205
select
*
from
t1
where
x
=
2
for
update
;
rollback
;
connection
con1
;
commit
;
# share locking
# PK access
...
...
@@ -125,7 +142,7 @@ rollback;
connection
con1
;
commit
;
# scan
#
table
scan
connection
con1
;
begin
;
select
*
from
t1
where
y
=
'one'
or
y
=
'three'
lock
in
share
mode
;
...
...
@@ -143,6 +160,24 @@ rollback;
connection
con1
;
commit
;
# index scan
connection
con1
;
begin
;
select
*
from
t1
where
z
>
1
and
z
<
3
lock
in
share
mode
;
connection
con2
;
begin
;
select
*
from
t1
where
z
=
1
lock
in
share
mode
;
# Have to check with pk access here since scans take locks on
# all rows and then release them in chunks
select
*
from
t1
where
x
=
1
for
update
;
--
error
1205
select
*
from
t1
where
x
=
2
for
update
;
rollback
;
connection
con1
;
commit
;
drop
table
t1
;
# End of 4.1 tests
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