mirror of
https://github.com/MariaDB/server.git
synced 2026-01-10 05:24:49 +01:00
The test fails sporadically due to an insufficient --replace_regex. The output of SHOW ENGINE INNODB STATUS can have some "not started" transactions in additional to the "ACTIVE" transaction the test wants to display, and the --replace_regex would wrongly pick one of the "not started" transactions to show if it occured after the "ACTIVE" one in the output. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
45 lines
1.4 KiB
Text
45 lines
1.4 KiB
Text
--source include/have_innodb.inc
|
|
|
|
CREATE TABLE t1(a INT PRIMARY KEY, b VARCHAR(40), c INT, INDEX(b,c))
|
|
ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1,'1',1),(2,'2',1);
|
|
|
|
SET @save_locks= @@GLOBAL.innodb_status_output_locks;
|
|
SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = 'ON';
|
|
|
|
let $isolation= 4;
|
|
while ($isolation) {
|
|
let $tx_isolation= `SELECT CASE $isolation
|
|
WHEN 1 THEN 'READ UNCOMMITTED'
|
|
WHEN 2 THEN 'READ COMMITTED'
|
|
WHEN 3 THEN 'REPEATABLE READ'
|
|
ELSE 'SERIALIZABLE' END`;
|
|
|
|
eval SET TRANSACTION ISOLATION LEVEL $tx_isolation;
|
|
BEGIN;
|
|
DELETE FROM t1 WHERE b='2' AND c=2;
|
|
# The SHOW ENGINE INNODB STATUS looks like this:
|
|
#
|
|
# ...
|
|
# +LIST OF TRANSACTIONS FOR EACH SESSION:
|
|
# +---TRANSACTION (0x7f1e08168300), not started
|
|
# +0 lock struct(s), heap size 1144, 0 row lock(s)
|
|
# +---TRANSACTION (0x7f1e08167780), not started
|
|
# +0 lock struct(s), heap size 1144, 0 row lock(s)
|
|
# +---TRANSACTION 25, ACTIVE 0 sec
|
|
# +2 lock struct(s), heap size 1144, 1 row lock(s)
|
|
# ...
|
|
#
|
|
# We want the lock struct(s) and row lock(s) of the ACTIVE transaction, but
|
|
# not of any inactive ones. Note the use of non-greedy match ".*?", so that
|
|
# we get the values for the ACTIVE transaction, not the last values in the
|
|
# list.
|
|
--replace_regex /.*---TRANSACTION \d+, ACTIVE.*?(\d+ lock struct...), heap size \d+(, \d+ row lock...).*/\1\2/
|
|
SHOW ENGINE INNODB STATUS;
|
|
ROLLBACK;
|
|
|
|
dec $isolation;
|
|
}
|
|
|
|
SET GLOBAL INNODB_STATUS_OUTPUT_LOCKS = @save_locks;
|
|
DROP TABLE t1;
|