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
3ddb4fdd
Commit
3ddb4fdd
authored
Feb 15, 2021
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-24738: Extend the test innodb.deadlock_detect
parent
272a1289
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
21 deletions
+36
-21
mysql-test/suite/innodb/r/deadlock_detect.result
mysql-test/suite/innodb/r/deadlock_detect.result
+8
-8
mysql-test/suite/innodb/t/deadlock_detect.combinations
mysql-test/suite/innodb/t/deadlock_detect.combinations
+7
-0
mysql-test/suite/innodb/t/deadlock_detect.test
mysql-test/suite/innodb/t/deadlock_detect.test
+21
-13
No files found.
mysql-test/suite/innodb/r/deadlock_detect.result
View file @
3ddb4fdd
SET GLOBAL innodb_deadlock_detect=OFF;
SET GLOBAL innodb_lock_wait_timeout=2;
connection default;
connection default;
CREATE TABLE t1(
CREATE TABLE t1(
id INT,
id INT,
...
@@ -7,18 +5,20 @@ PRIMARY KEY(id)
...
@@ -7,18 +5,20 @@ PRIMARY KEY(id)
) ENGINE=InnoDB;
) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1), (2), (3);
INSERT INTO t1 VALUES(1), (2), (3);
BEGIN;
BEGIN;
SELECT * FROM t1 WHERE id = 1
FOR UPDAT
E;
SELECT * FROM t1 WHERE id = 1
LOCK IN SHARE MOD
E;
connect con1,localhost,root,,;
connect con1,localhost,root,,;
BEGIN;
BEGIN;
SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
SELECT * FROM t1 WHERE id = 2 LOCK IN SHARE MODE;
connect con2,localhost,root,,;
BEGIN;
SELECT * FROM t1 WHERE id = 2 LOCK IN SHARE MODE;
SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
SELECT * FROM t1 WHERE id = 1 FOR UPDATE;
connection default;
connection default;
SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
SELECT * FROM t1 WHERE id = 2 FOR UPDATE;
connection con
1
;
connection con
2
;
ROLLBACK;
ROLLBACK;
disconnect con2;
disconnect con1;
connection default;
connection default;
ROLLBACK;
ROLLBACK;
DROP TABLE t1;
DROP TABLE t1;
disconnect con1;
SET GLOBAL innodb_lock_wait_timeout=default;
SET GLOBAL innodb_deadlock_detect=default;
mysql-test/suite/innodb/t/deadlock_detect.combinations
0 → 100644
View file @
3ddb4fdd
[OFF]
--innodb-deadlock-detect=OFF
--innodb-lock-wait-timeout=1
[ON]
--innodb-deadlock-detect=ON
--innodb-lock-wait-timeout=1
mysql-test/suite/innodb/t/deadlock_detect.test
View file @
3ddb4fdd
...
@@ -3,11 +3,9 @@
...
@@ -3,11 +3,9 @@
#
#
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
--
source
include
/
not_embedded
.
inc
--
source
include
/
count_sessions
.
inc
--
source
include
/
count_sessions
.
inc
SET
GLOBAL
innodb_deadlock_detect
=
OFF
;
let
$have_deadlock
=
`select @@GLOBAL.innodb_deadlock_detect`
;
SET
GLOBAL
innodb_lock_wait_timeout
=
2
;
connection
default
;
connection
default
;
...
@@ -22,24 +20,33 @@ INSERT INTO t1 VALUES(1), (2), (3);
...
@@ -22,24 +20,33 @@ INSERT INTO t1 VALUES(1), (2), (3);
--
disable_result_log
--
disable_result_log
BEGIN
;
BEGIN
;
SELECT
*
FROM
t1
WHERE
id
=
1
FOR
UPDAT
E
;
SELECT
*
FROM
t1
WHERE
id
=
1
LOCK
IN
SHARE
MOD
E
;
connect
(
con1
,
localhost
,
root
,,);
connect
(
con1
,
localhost
,
root
,,);
BEGIN
;
BEGIN
;
SELECT
*
FROM
t1
WHERE
id
=
2
LOCK
IN
SHARE
MODE
;
SELECT
*
FROM
t1
WHERE
id
=
2
FOR
UPDATE
;
connect
(
con2
,
localhost
,
root
,,);
BEGIN
;
SELECT
*
FROM
t1
WHERE
id
=
2
LOCK
IN
SHARE
MODE
;
send
SELECT
*
FROM
t1
WHERE
id
=
1
FOR
UPDATE
;
send
SELECT
*
FROM
t1
WHERE
id
=
1
FOR
UPDATE
;
connection
default
;
connection
default
;
send
SELECT
*
FROM
t1
WHERE
id
=
2
FOR
UPDATE
;
send
SELECT
*
FROM
t1
WHERE
id
=
2
FOR
UPDATE
;
connection
con1
;
connection
con2
;
if
(
!
$have_deadlock
)
{
--
error
ER_LOCK_WAIT_TIMEOUT
--
error
ER_LOCK_WAIT_TIMEOUT
reap
;
reap
;
}
if
(
$have_deadlock
)
{
--
error
0
,
ER_LOCK_DEADLOCK
reap
;
}
ROLLBACK
;
ROLLBACK
;
disconnect
con2
;
disconnect
con1
;
#
#
# Note here that con1 is the older transaction as it
# Note here that con1 is the older transaction as it
...
@@ -50,8 +57,14 @@ ROLLBACK;
...
@@ -50,8 +57,14 @@ ROLLBACK;
# and does the update.
# and does the update.
#
#
connection
default
;
connection
default
;
if
(
!
$have_deadlock
)
{
--
error
0
,
ER_LOCK_WAIT_TIMEOUT
--
error
0
,
ER_LOCK_WAIT_TIMEOUT
reap
;
reap
;
}
if
(
$have_deadlock
)
{
--
error
0
,
ER_LOCK_DEADLOCK
reap
;
}
ROLLBACK
;
ROLLBACK
;
...
@@ -59,9 +72,4 @@ ROLLBACK;
...
@@ -59,9 +72,4 @@ ROLLBACK;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
disconnect
con1
;
--
source
include
/
wait_until_count_sessions
.
inc
--
source
include
/
wait_until_count_sessions
.
inc
SET
GLOBAL
innodb_lock_wait_timeout
=
default
;
SET
GLOBAL
innodb_deadlock_detect
=
default
;
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