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
4c3e861b
Commit
4c3e861b
authored
May 14, 2007
by
vasil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test about the behavior introduced in r1497.
parent
765be34d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
0 deletions
+82
-0
mysql-test/innodb_trx_weight.result
mysql-test/innodb_trx_weight.result
+25
-0
mysql-test/innodb_trx_weight.test
mysql-test/innodb_trx_weight.test
+57
-0
No files found.
mysql-test/innodb_trx_weight.result
0 → 100644
View file @
4c3e861b
SET storage_engine=InnoDB;
DROP TABLE IF EXISTS t1, t2, t3;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
INSERT INTO t3 VALUES (1), (2), (3);
SET autocommit=0;
SELECT * FROM t1 FOR UPDATE;
a
1
SET autocommit=0;
SELECT * FROM t2 FOR UPDATE;
a
1
SELECT * FROM t3 FOR UPDATE;
a
1
2
3
INSERT INTO t2 VALUES (0);
INSERT INTO t1 VALUES (0);
Got one of the listed errors
DROP TABLE t1, t2, t3;
mysql-test/innodb_trx_weight.test
0 → 100644
View file @
4c3e861b
#
# Ensure that the number of locks (SELECT FOR UPDATE for example) is
# added to the number of altered rows when choosing the smallest
# transaction to kill as a victim when a deadlock is detected.
#
--
source
include
/
have_innodb
.
inc
SET
storage_engine
=
InnoDB
;
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
--
enable_warnings
# we will create a simple deadlock with t1, t2 and two connections
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t2
(
a
INT
);
# auxiliary table with a bulk of rows which will be locked by the second
# transaction to increase its weight
CREATE
TABLE
t3
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
);
INSERT
INTO
t2
VALUES
(
1
);
INSERT
INTO
t3
VALUES
(
1
),
(
2
),
(
3
);
--
connect
(
con1
,
localhost
,,,)
--
connect
(
con2
,
localhost
,,,)
--
connection
con1
SET
autocommit
=
0
;
SELECT
*
FROM
t1
FOR
UPDATE
;
--
connection
con2
SET
autocommit
=
0
;
SELECT
*
FROM
t2
FOR
UPDATE
;
SELECT
*
FROM
t3
FOR
UPDATE
;
--
connection
con1
--
send
INSERT
INTO
t2
VALUES
(
0
);
--
connection
con2
INSERT
INTO
t1
VALUES
(
0
);
--
connection
con1
# we do not want this test to fail if the very descriptive text
# "ERROR 40001: Deadlock found when trying to get lock; try restarting transaction"
# gets changed someday, so force mysqltest to emit
# "Got one of the listed errors"
--
error
ER_LOCK_DEADLOCK
,
ER_LOCK_DEADLOCK
--
reap
--
connection
default
--
disconnect
con1
--
disconnect
con2
DROP
TABLE
t1
,
t2
,
t3
;
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