Current Path : /home/usr.opt/mysql57/mysql-test/suite/innodb/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/innodb/r/innodb_i_s_innodb_trx.result |
SET GLOBAL innodb_lock_wait_timeout=600; DESCRIBE INFORMATION_SCHEMA.INNODB_TRX; Field Type Null Key Default Extra trx_id varchar(18) NO trx_state varchar(13) NO trx_started datetime NO 0000-00-00 00:00:00 trx_requested_lock_id varchar(81) YES NULL trx_wait_started datetime YES NULL trx_weight bigint(21) unsigned NO 0 trx_mysql_thread_id bigint(21) unsigned NO 0 trx_query varchar(1024) YES NULL trx_operation_state varchar(64) YES NULL trx_tables_in_use bigint(21) unsigned NO 0 trx_tables_locked bigint(21) unsigned NO 0 trx_lock_structs bigint(21) unsigned NO 0 trx_lock_memory_bytes bigint(21) unsigned NO 0 trx_rows_locked bigint(21) unsigned NO 0 trx_rows_modified bigint(21) unsigned NO 0 trx_concurrency_tickets bigint(21) unsigned NO 0 trx_isolation_level varchar(16) NO trx_unique_checks int(1) NO 0 trx_foreign_key_checks int(1) NO 0 trx_last_foreign_key_error varchar(256) YES NULL trx_adaptive_hash_latched int(1) NO 0 trx_adaptive_hash_timeout bigint(21) unsigned NO 0 trx_is_read_only int(1) NO 0 trx_autocommit_non_locking int(1) NO 0 DROP TABLE IF EXISTS t1; 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); 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 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 4 0 1 7 1 0 REPEATABLE READ 1 1 ROLLBACK; SET FOREIGN_KEY_CHECKS = 0; SET UNIQUE_CHECKS = 0; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN; INSERT INTO t1 VALUES (6,12); 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 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 `t2_ibfk_1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`)) 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 `t2_ibfk_1` FOREIGN KEY (`c02`) REFERENCES `t1` (`c01`) DROP TABLE t2; DROP TABLE t1; SET GLOBAL innodb_lock_wait_timeout=default;