File: innodb_i_s_innodb_trx.result

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (90 lines) | stat: -rw-r--r-- 3,278 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
SET @save_timeout=@@GLOBAL.innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout=100000000;
DESCRIBE INFORMATION_SCHEMA.INNODB_TRX;
Field	Type	Null	Key	Default	Extra
trx_id	bigint(21) unsigned	NO		NULL	
trx_state	varchar(13)	NO		NULL	
trx_started	datetime	NO		NULL	
trx_requested_lock_id	varchar(81)	YES		NULL	
trx_wait_started	datetime	YES		NULL	
trx_weight	bigint(21) unsigned	NO		NULL	
trx_mysql_thread_id	bigint(21) unsigned	NO		NULL	
trx_query	varchar(1024)	YES		NULL	
trx_operation_state	varchar(64)	YES		NULL	
trx_tables_in_use	bigint(21) unsigned	NO		NULL	
trx_tables_locked	bigint(21) unsigned	NO		NULL	
trx_lock_structs	bigint(21) unsigned	NO		NULL	
trx_lock_memory_bytes	bigint(21) unsigned	NO		NULL	
trx_rows_locked	bigint(21) unsigned	NO		NULL	
trx_rows_modified	bigint(21) unsigned	NO		NULL	
trx_concurrency_tickets	bigint(21) unsigned	NO		NULL	
trx_isolation_level	enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE')	NO		NULL	
trx_unique_checks	int(1)	NO		NULL	
trx_foreign_key_checks	int(1)	NO		NULL	
trx_last_foreign_key_error	varchar(256)	YES		NULL	
trx_is_read_only	int(1)	NO		NULL	
trx_autocommit_non_locking	int(1)	NO		NULL	
CREATE TABLE t1 (
c01 INT,
c02 INT,
PRIMARY KEY (c01)
) ENGINE=INNODB STATS_AUTO_RECALC=0;
INSERT INTO t1 VALUES
(1,2),(2,4),(3,6),(4,8);
CREATE TABLE t2 (
c01 INT,
c02 INT,
PRIMARY KEY (c01),
FOREIGN KEY fk1 (c02) REFERENCES t1 (c01)
) ENGINE=INNODB STATS_AUTO_RECALC=0;
INSERT INTO t2 VALUES
(1,1),(2,2),(3,3);
connect  con_trx,localhost,root,,;
connect  con_verify_innodb_trx,localhost,root,,;
connection con_trx;
SET autocommit=0;
INSERT INTO t1 VALUES (5,10);
SELECT * FROM t1 FOR UPDATE;
c01	c02
1	2
2	4
3	6
4	8
5	10
connection con_verify_innodb_trx;
SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked,
trx_rows_locked, trx_rows_modified, trx_concurrency_tickets,
trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
FROM INFORMATION_SCHEMA.INNODB_TRX;
trx_state	trx_weight	trx_tables_in_use	trx_tables_locked	trx_rows_locked	trx_rows_modified	trx_concurrency_tickets	trx_isolation_level	trx_unique_checks	trx_foreign_key_checks
RUNNING	3	0	1	6	1	0	REPEATABLE READ	1	1
connection con_trx;
ROLLBACK;
SET FOREIGN_KEY_CHECKS = 0;
SET UNIQUE_CHECKS = 0;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BEGIN;
INSERT INTO t1 VALUES (6,12);
connection con_verify_innodb_trx;
SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
FROM INFORMATION_SCHEMA.INNODB_TRX;
trx_isolation_level	trx_unique_checks	trx_foreign_key_checks
SERIALIZABLE	0	0
connection con_trx;
ROLLBACK;
SET FOREIGN_KEY_CHECKS = 1;
SET UNIQUE_CHECKS = 1;
BEGIN;
INSERT INTO t2 VALUES (4,10);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`))
disconnect con_trx;
connection con_verify_innodb_trx;
SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error
FROM INFORMATION_SCHEMA.INNODB_TRX;
trx_state	trx_isolation_level	trx_last_foreign_key_error
RUNNING	REPEATABLE READ	`test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)
disconnect con_verify_innodb_trx;
connection default;
DROP TABLE t2;
DROP TABLE t1;
SET GLOBAL innodb_lock_wait_timeout=@save_timeout;