Debian Codegraph @

mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result

raw
1 SET @save_timeout=@@GLOBAL.innodb_lock_wait_timeout;
2 SET GLOBAL innodb_lock_wait_timeout=100000000;
3 DESCRIBE INFORMATION_SCHEMA.INNODB_TRX;
4 Field Type Null Key Default Extra
5 trx_id bigint(21) unsigned NO NULL
6 trx_state varchar(13) NO NULL
7 trx_started datetime NO NULL
8 trx_requested_lock_id varchar(81) YES NULL
9 trx_wait_started datetime YES NULL
10 trx_weight bigint(21) unsigned NO NULL
11 trx_mysql_thread_id bigint(21) unsigned NO NULL
12 trx_query varchar(1024) YES NULL
13 trx_operation_state varchar(64) YES NULL
14 trx_tables_in_use bigint(21) unsigned NO NULL
15 trx_tables_locked bigint(21) unsigned NO NULL
16 trx_lock_structs bigint(21) unsigned NO NULL
17 trx_lock_memory_bytes bigint(21) unsigned NO NULL
18 trx_rows_locked bigint(21) unsigned NO NULL
19 trx_rows_modified bigint(21) unsigned NO NULL
20 trx_concurrency_tickets bigint(21) unsigned NO NULL
21 trx_isolation_level enum('READ UNCOMMITTED','READ COMMITTED','REPEATABLE READ','SERIALIZABLE') NO NULL
22 trx_unique_checks int(1) NO NULL
23 trx_foreign_key_checks int(1) NO NULL
24 trx_last_foreign_key_error varchar(256) YES NULL
25 trx_is_read_only int(1) NO NULL
26 trx_autocommit_non_locking int(1) NO NULL
27 CREATE TABLE t1 (
28 c01 INT,
29 c02 INT,
30 PRIMARY KEY (c01)
31 ) ENGINE=INNODB STATS_AUTO_RECALC=0;
32 INSERT INTO t1 VALUES
33 (1,2),(2,4),(3,6),(4,8);
34 CREATE TABLE t2 (
35 c01 INT,
36 c02 INT,
37 PRIMARY KEY (c01),
38 FOREIGN KEY fk1 (c02) REFERENCES t1 (c01)
39 ) ENGINE=INNODB STATS_AUTO_RECALC=0;
40 INSERT INTO t2 VALUES
41 (1,1),(2,2),(3,3);
42 connect con_trx,localhost,root,,;
43 connect con_verify_innodb_trx,localhost,root,,;
44 connection con_trx;
45 SET autocommit=0;
46 INSERT INTO t1 VALUES (5,10);
47 SELECT * FROM t1 FOR UPDATE;
48 c01 c02
49 1 2
50 2 4
51 3 6
52 4 8
53 5 10
54 connection con_verify_innodb_trx;
55 SELECT trx_state, trx_weight, trx_tables_in_use, trx_tables_locked,
56 trx_rows_locked, trx_rows_modified, trx_concurrency_tickets,
57 trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
58 FROM INFORMATION_SCHEMA.INNODB_TRX;
59 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
60 RUNNING 3 0 1 6 1 0 REPEATABLE READ 1 1
61 connection con_trx;
62 ROLLBACK;
63 SET FOREIGN_KEY_CHECKS = 0;
64 SET UNIQUE_CHECKS = 0;
65 SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
66 BEGIN;
67 INSERT INTO t1 VALUES (6,12);
68 connection con_verify_innodb_trx;
69 SELECT trx_isolation_level, trx_unique_checks, trx_foreign_key_checks
70 FROM INFORMATION_SCHEMA.INNODB_TRX;
71 trx_isolation_level trx_unique_checks trx_foreign_key_checks
72 SERIALIZABLE 0 0
73 connection con_trx;
74 ROLLBACK;
75 SET FOREIGN_KEY_CHECKS = 1;
76 SET UNIQUE_CHECKS = 1;
77 BEGIN;
78 INSERT INTO t2 VALUES (4,10);
79 ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`))
80 disconnect con_trx;
81 connection con_verify_innodb_trx;
82 SELECT trx_state, trx_isolation_level, trx_last_foreign_key_error
83 FROM INFORMATION_SCHEMA.INNODB_TRX;
84 trx_state trx_isolation_level trx_last_foreign_key_error
85 RUNNING REPEATABLE READ `test`.`t2`, CONSTRAINT `fk1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)
86 disconnect con_verify_innodb_trx;
87 connection default;
88 DROP TABLE t2;
89 DROP TABLE t1;
90 SET GLOBAL innodb_lock_wait_timeout=@save_timeout;