| 1 |
--source include/have_innodb.inc |
| 2 |
|
| 3 |
CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(40), c INT, INDEX(b,c)) |
| 4 |
ENGINE=InnoDB; |
| 5 |
INSERT INTO t1 VALUES (1,'1',1),(2,'2',1),(3,'3',1); |
| 6 |
|
| 7 |
SET @save_locks= @@GLOBAL.innodb_status_output_locks; |
| 8 |
SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = 'ON'; |
| 9 |
let $default_id= `select connection_id()`; |
| 10 |
let $reg= /.*---TRANSACTION \d+, ACTIVE.*?(\d+ lock struct...), heap size \d+(, \d+ row lock...).*?\nMariaDB thread id $default_id,.*/\1\2/; |
| 11 |
|
| 12 |
let $isolation= 4; |
| 13 |
while ($isolation) { |
| 14 |
let $tx_isolation= `SELECT CASE $isolation |
| 15 |
WHEN 1 THEN 'READ UNCOMMITTED' |
| 16 |
WHEN 2 THEN 'READ COMMITTED' |
| 17 |
WHEN 3 THEN 'REPEATABLE READ' |
| 18 |
ELSE 'SERIALIZABLE' END`; |
| 19 |
|
| 20 |
eval SET TRANSACTION ISOLATION LEVEL $tx_isolation; |
| 21 |
BEGIN; |
| 22 |
DELETE FROM t1 WHERE b='2' AND c=2; |
| 23 |
# The SHOW ENGINE INNODB STATUS looks like this: |
| 24 |
# |
| 25 |
# ... |
| 26 |
# +LIST OF TRANSACTIONS FOR EACH SESSION: |
| 27 |
# +---TRANSACTION (0x7f1e08168300), not started |
| 28 |
# +0 lock struct(s), heap size 1144, 0 row lock(s) |
| 29 |
# +---TRANSACTION (0x7f1e08167780), not started |
| 30 |
# +0 lock struct(s), heap size 1144, 0 row lock(s) |
| 31 |
# +---TRANSACTION 25, ACTIVE 0 sec |
| 32 |
# +2 lock struct(s), heap size 1144, 1 row lock(s) |
| 33 |
# ... |
| 34 |
# |
| 35 |
# We want the lock struct(s) and row lock(s) of the ACTIVE transaction, but |
| 36 |
# not of any inactive ones. Note the use of non-greedy match ".*?", so that |
| 37 |
# we get the values for the ACTIVE transaction, not the last values in the |
| 38 |
# list. |
| 39 |
--replace_regex $reg |
| 40 |
SHOW ENGINE INNODB STATUS; |
| 41 |
ROLLBACK; |
| 42 |
|
| 43 |
dec $isolation; |
| 44 |
} |
| 45 |
|
| 46 |
SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = @save_locks; |
| 47 |
DROP TABLE t1; |