Current Path : /home/usr.opt/mysql57/mysql-test/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/r/session_tracker_trx_state.result |
# # WL#6631: Detect transaction boundaries # ######################################################################## # # set up: save settings # SET autocommit=1; # if we track CHARACTERISTICS, we must also track the tx_* sysvars! SELECT @@session.session_track_system_variables INTO @old_track_list; SET @track_list= CONCAT(@old_track_list, ",transaction_read_only,transaction_isolation "); SET SESSION session_track_system_variables=@track_list; SELECT @@session.session_track_state_change INTO @old_track_enable; SET SESSION session_track_state_change=TRUE; SELECT @@session.session_track_transaction_info INTO @old_track_tx; SET SESSION query_cache_type = 0; Warnings: Warning 1287 '@@query_cache_type' is deprecated and will be removed in a future release. FLUSH STATUS; ######################################################################## # # test "STATE" tracking: transaction type transitions # SET SESSION session_track_transaction_info="STATE"; # 3.1.1.1.1 "explicit transaction active" START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # 3.1.1.1.1 ending explicit transaction explicitly COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # 3.1.1.1.1 ending explicit transaction implicitly CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ DROP TABLE t1; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # 3.1.1.2 "no work attached" START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SET @dummy=0; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # 3.1.1.1.2 "implicit transaction active" # SET autocommit=0; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- OFF -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; INSERT INTO t1 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W___ SELECT f1 FROM t1 LIMIT 1 INTO @dummy; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I_R_Ws__ SELECT f1 FROM t1; f1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I_R_WsS_ BEGIN WORK; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ DROP TABLE t1; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SELECT RAND(22) INTO @dummy; COMMIT; CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; SELECT RAND(22) INTO @dummy; SET TRANSACTION READ WRITE; INSERT INTO t1 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W___ SET TRANSACTION READ WRITE; ERROR 25001: Transaction characteristics can't be changed while a transaction is in progress DROP TABLE t1; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET autocommit=1; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 ######################################################################## # # test "STATE" tracking: transaction state reporting # CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; # We don't report when in autocommit mode and outside a transaction: INSERT INTO t1 VALUES(1); SELECT 1 FROM DUAL; 1 1 DELETE FROM t1; START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # add "unsafe stmt" to the set: SET @x=UUID(); -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T____s__ # next stmt is safe, but unsafe flag should stick: SET @x=1; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 # however, after C/A/C, the status should revert to "empty trx": COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # SELECT with no tables gives us just a result set SELECT 1 FROM DUAL; 1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_____S_ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # SELECT with no tables and no result set SELECT 1 FROM DUAL INTO OUTFILE 'VARDIR/tmp/wl6631.csv'; COMMIT AND CHAIN; # SELECT with trx tables but no result set SELECT f1 FROM t1 INTO OUTFILE 'VARDIR/tmp/wl6631.csv';; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # SELECT with non-trx tables but no result set SELECT f1 FROM t2 INTO OUTFILE 'VARDIR/tmp/wl6631.csv';; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- Tr______ # show that "unsafe read" sticks (isn't cleared by the dummy SELECT) SELECT 1 FROM DUAL INTO @x; # clear state COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t1; DROP TABLE t2; # read with and without result set: CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; CREATE TABLE t2 (f1 INT) ENGINE="InnoDB"; INSERT INTO t1 VALUES (123); BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT f1 FROM t1; f1 123 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R___S_ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ INSERT INTO t2 SELECT f1 FROM t1; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_W___ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t1; DROP TABLE t2; # states: read + write; transactional + non-transactional # state should be "no transaction": CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; # resulting state should be "T", transaction started, no data modified: START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # resulting state should be "W", transactional write pending: INSERT INTO t1 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T___W___ # resulting state should be "wW", both safe and unsafe writes happened: INSERT INTO t2 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T__wW___ # resulting state should STILL be "wW"! INSERT INTO t1 VALUES (1); ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # resulting state should be "w", unsafe non-transaction write happened: INSERT INTO t2 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T__w____ # resulting state should be "wW", both safe and unsafe writes happened: INSERT INTO t1 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T__wW___ # resulting state should be "RwW" (adding transactional read): SELECT f1 FROM t1; f1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_RwW_S_ # resulting state should be "rRwW" (adding non-transactional read): SELECT f1 FROM t2; f1 1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrRwW_S_ ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t1, t2; # autocommit (0) CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; SET autocommit=0; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- OFF -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET @x=UUID(); -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET @x=1; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET @x=UUID(); -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 # SET TRANSACTION one-shot should generate a tracker item when # tracking statements. Transaction state however should not change. # We can still set chistics here because in_active_multi_stmt_transaction() # is still false (!SERVER_STATUS_IN_TRANS). SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; INSERT INTO t1 VALUES(1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W___ # Now that we've involved tables in the implicit transaction, we're # no longer allowed to change its chistics: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; ERROR 25001: Transaction characteristics can't be changed while a transaction is in progress BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ INSERT INTO t1 VALUES(3); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T___W___ DROP TABLE t1; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT 1 FROM DUAL; 1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_____S_ SELECT 1 FROM DUAL INTO @dummy; COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; SELECT f1 FROM t2; f1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- Ir____S_ DROP TABLE t2; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET autocommit=1; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 ######################################################################## # # test "CHARACTERISTICS" tracking # SET SESSION session_track_transaction_info="CHARACTERISTICS"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ START TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # state is again "we have an empty transaction", so make no state item START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ ONLY; START TRANSACTION READ WRITE, WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION WITH CONSISTENT SNAPSHOT, READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ START TRANSACTION READ ONLY, WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION WITH CONSISTENT SNAPSHOT, READ ONLY; # chain read chistics, but not snapshot: COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SET TRANSACTION READ ONLY; ERROR 25001: Transaction characteristics can't be changed while a transaction is in progress # will create an empty characteristics item by convention, plus 0 state ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # chistics: READ ONLY SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; # chistics: READ ONLY + ISOL RR SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION READ ONLY; # chistics: READ ONLY + ISOL RR SET TRANSACTION READ ONLY; # chistics: READ WRITE + ISOL RR SET TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION READ WRITE; # chistics: READ WRITE + ISOL RR SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; # chistics: READ ONLY + ISOL SER SET TRANSACTION READ ONLY, ISOLATION LEVEL SERIALIZABLE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; SET TRANSACTION READ ONLY; # chistics: READ ONLY + ISOL SER BEGIN WORK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET SESSION tx_read_only=0; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 Warnings: Warning 1287 '@@tx_read_only' is deprecated and will be removed in a future release. Please use '@@transaction_read_only' instead # one-shot (different from session default) SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # one-shot (repeats session default) SET TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ WRITE; START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # session SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- transaction_isolation -- READ-UNCOMMITTED -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- # "isolation" one-shot is set, and added to chistics tracker (=> 1 item) SET TRANSACTION ISOLATION LEVEL READ COMMITTED; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; # "read-only" one-shot is set, and added to chistics tracker (=> 2 items) SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; SET TRANSACTION READ ONLY; # setting the session default: # - we receive "changed variable" for @@session.tx_read_only # - "read-only" one-shot is cleared, disappears from chistics tracker # - "isolation" one-shot remains set, and remains in chistics tracker SET SESSION TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- transaction_read_only -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; # chistics: isolation level is READ COMMITTED (from one-shot), READ ONLY # or READ WRITE not given, as we're using session default again START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # chistics: READ ONLY SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; # chistics: READ ONLY, READ COMM SET TRANSACTION ISOLATION LEVEL READ COMMITTED; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; SET TRANSACTION READ ONLY; # chistics: SESSION resets ISOL one-shot, READ ONLY remains SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- transaction_isolation -- READ-UNCOMMITTED -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; # chistics: SESSION resets READ one-shot, nothing remains SET SESSION TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- transaction_read_only -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- transaction_isolation -- REPEATABLE-READ -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET SESSION TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- transaction_read_only -- OFF -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 # show that START TRANSACTION READ ... overrides SET TRANSACTION READ .. SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; START TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # chistics AND CHAIN SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ ONLY; ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET TRANSACTION ISOLATION LEVEL READ COMMITTED; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ ROLLBACK AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL READ COMMITTED; START TRANSACTION READ ONLY; COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # show that session_track_transaction_info="STATE" will hide some edges SET session_track_transaction_info="STATE"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 # normal syntax: TR->T->0 START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # normal syntax: T->T->0 START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # state does not change, and therefore isn't reported COMMIT AND CHAIN; COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # pathological syntax: TR->TR->0 START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ # state does not change, and therefore isn't reported START TRANSACTION WITH CONSISTENT SNAPSHOT; COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # show that session_track_transaction_info="CHARACTERISTICS" shows more edges SET session_track_transaction_info="CHARACTERISTICS"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- # normal syntax: TR->T->0 START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # normal syntax: T->T->0 START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT AND CHAIN; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # pathological syntax: TR->TR->0 START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_____ START TRANSACTION WITH CONSISTENT SNAPSHOT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION WITH CONSISTENT SNAPSHOT; COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # chistics and interaction of implicit trx and explicit trx CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; SET autocommit=0; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- OFF -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; INSERT INTO t1 VALUES(1); ERROR 25006: Cannot execute statement in a READ ONLY transaction. ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ WRITE; SET TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION READ WRITE; INSERT INTO t1 VALUES(1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W___ SET TRANSACTION READ WRITE; ERROR 25001: Transaction characteristics can't be changed while a transaction is in progress START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION READ ONLY; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ DROP TABLE t1; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; INSERT INTO t1 VALUES(1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W___ # implicit commit (chistics item here, clearing isolation level): ALTER TABLE t1 ADD COLUMN f2 INT; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ INSERT INTO t1 VALUES(2,2); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W___ # implicit commit (no chistics item here): ALTER TABLE t1 ADD COLUMN f3 INT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- START TRANSACTION; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t1; SET autocommit=1; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET session_track_transaction_info="STATE"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 ######################################################################## # # show that table access reporting works in multi-statements # # multi-stmt #1 CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; INSERT INTO t2 VALUES (1); BEGIN; | -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t2; # multi-stmt #2 CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ COMMIT; INSERT INTO t2 VALUES (1); BEGIN; INSERT INTO t1 VALUES (99); | -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T___W___ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t1; DROP TABLE t2; ######################################################################## # # show that table access reporting works in Stored Functions (SF) # CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; INSERT INTO t1 VALUES (1); # create func1() in system table: CREATE FUNCTION func1() RETURNS INTEGER BEGIN SET @dummy = 0; IF (SELECT * FROM t1) THEN SET @dummy = 1; END IF; RETURN @dummy; END| # func1() reads a trx table (and is read from a system table!): BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT func1(); func1() 1 -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R___S_ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t1; # drop func1() from system table: DROP FUNCTION func1; ######################################################################## # # show that reporting works for Stored Procedures (SP) # CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (2); CREATE PROCEDURE proc1() BEGIN SET @dummy = 0; IF (SELECT f1 FROM t1) THEN SET @dummy = 1; END IF; END| CREATE PROCEDURE proc2() BEGIN CALL proc1(); UPDATE t1 SET f1=4; END| CREATE PROCEDURE proc3() BEGIN DECLARE x CHAR(36); SET x=UUID(); END| CREATE PROCEDURE proc4(x CHAR(36)) BEGIN END| CREATE PROCEDURE proc5() BEGIN SELECT f1 FROM t1; SELECT f1 FROM t2; END| CREATE PROCEDURE proc6a() BEGIN IF (SELECT f1 FROM t1) THEN SET @dummy = 1; END IF; ALTER TABLE t1 ADD COLUMN f2 INT; IF (SELECT f1 FROM t2) THEN SET @dummy = 1; END IF; END| CREATE PROCEDURE proc6b() BEGIN SELECT f1 FROM t1; ALTER TABLE t1 ADD COLUMN f3 INT; SELECT f1 FROM t2; END| CREATE PROCEDURE proc7(x INT) BEGIN SELECT f1 FROM t1; SELECT f1*2 FROM t1; END| CREATE PROCEDURE proc8(x INT) BEGIN SELECT f1 FROM t1; IF (SELECT f1 FROM t2) THEN SET @dummy = 1; END IF; END| CREATE PROCEDURE proc9(x INT) BEGIN SELECT f1 FROM t1; IF (SELECT f1 FROM t1) THEN SET @dummy = 1; END IF; END| BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # example unsafe call: CALL proc3(); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T____s__ # report on tables accessed within SP: CALL proc1(); -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R__s__ # report on tables accessed within all (nested) SP: CALL proc2(); -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R_Ws__ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ CALL proc4(UUID()); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T____s__ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # multiple result sets: # autocommit=1, not in a transaction, no tracker item: CALL proc5(); f1 4 f1 2 BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # first SELECT adds R/S to present T and renders a tracker item; # second SELECT add r flag and renders another tracker item CALL proc5(); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R___S_ f1 2 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrR___S_ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET autocommit=0; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- OFF -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 # first SELECT renders I/R/S tracker item; # second SELECT add r flag and renders another tracker item CALL proc5(); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I_R___S_ f1 2 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- IrR___S_ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # first SELECT adds R/S to present T and renders a tracker item; # second SELECT add r flag and renders another tracker item CALL proc5(); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R___S_ f1 2 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrR___S_ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # multiple result sets; implicit commit between them BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # first SELECT adds R/S to present T and renders a tracker item; # second SELECT add r flag and renders another tracker item CALL proc6b(); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_R___S_ f1 2 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- Ir____S_ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # first SELECT adds R/S to present T and renders a tracker item; # second SELECT add r flag and renders another tracker item CALL proc6a(); -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- Ir______ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # multiple result sets; sub-query as argument, autocommit==0 BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT 1 FROM DUAL; 1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_____S_ CALL proc7((SELECT f1 FROM t2)); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrR___S_ f1*2 8 COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET autocommit=1; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 # multiple result sets; sub-query as argument, autocommit==1 BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT 1 FROM DUAL; 1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_____S_ CALL proc7((SELECT f1 FROM t2)); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrR___S_ f1*2 8 COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # not in a transaction, no tracking CALL proc8((SELECT f1 FROM t2)); f1 4 -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # body sets R/S in select, and r in sub-select CALL proc8((SELECT f1 FROM t2)); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrR___S_ -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ # argument sets r, body sets R CALL proc9((SELECT f1 FROM t2)); f1 4 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- TrR___S_ -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP PROCEDURE proc1; DROP PROCEDURE proc2; DROP PROCEDURE proc3; DROP PROCEDURE proc4; DROP PROCEDURE proc5; DROP PROCEDURE proc6a; DROP PROCEDURE proc6b; DROP PROCEDURE proc7; DROP PROCEDURE proc8; DROP PROCEDURE proc9; DROP TABLE t1; DROP TABLE t2; ######################################################################## # # interaction with system tables # CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT CONVERT_TZ('2004-01-01 12:00:00','GMT','MET'); CONVERT_TZ('2004-01-01 12:00:00','GMT','MET') NULL -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_____S_ COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ DROP TABLE t2; # # log tables # SET @old_log_output= @@global.log_output; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET @old_general_log= @@global.general_log; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SET @old_general_log_file= @@global.general_log_file; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 TRUNCATE TABLE mysql.general_log; SET GLOBAL log_output = 'TABLE'; SET GLOBAL general_log= 'ON'; BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT 1 FROM DUAL; 1 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_____S_ SELECT " -> ", argument FROM mysql.general_log WHERE argument LIKE '% DUAL' AND (command_type!='Prepare'); -> argument -> SELECT 1 FROM DUAL -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- Tr____S_ ROLLBACK; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ TRUNCATE TABLE mysql.general_log; SET GLOBAL general_log_file= @old_general_log_file; SET GLOBAL general_log= @old_general_log; SET GLOBAL log_output= @old_log_output; ######################################################################## # # show that table access reporting works with LOCK TABLES # CREATE TABLE t1 (f1 INT) ENGINE="InnoDB"; CREATE TABLE t2 (f1 INT) ENGINE="MyISAM"; SET autocommit=0; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- OFF -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SELECT 1 FROM DUAL; 1 1 SELECT f1 FROM t1; f1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I_R___S_ # no LOCK held this time, so no implicit commit: UNLOCK TABLES; # LOCK TABLES pre-commits: LOCK TABLES t1 WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I___W__L INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); SELECT f1 FROM t1; f1 1 2 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- I_R_W_SL COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- _______L SET TRANSACTION READ ONLY; SET TRANSACTION READ WRITE; UNLOCK TABLES; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET autocommit=1; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- autocommit -- ON -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 LOCK TABLE t1 WRITE, t2 WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- _______L INSERT INTO t2 VALUES (3); INSERT INTO t1 VALUES (3); SELECT f1 FROM t1 WHERE f1 > 2; f1 3 UNLOCK TABLES; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # don't report chistics for autocommits while LOCK is held SET SESSION session_track_transaction_info="CHARACTERISTICS"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- LOCK TABLE t1 WRITE; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- _______L INSERT INTO t1 VALUES (3); SELECT f1 FROM t1 WHERE f1 > 2; f1 3 3 UNLOCK TABLES; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET session_track_transaction_info="STATE"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 DROP TABLE t1; DROP TABLE t2; ######################################################################## # # query cache # SELECT @@global.query_cache_size INTO @old_qc_size; Warnings: Warning 1287 '@@query_cache_size' is deprecated and will be removed in a future release. SET GLOBAL query_cache_size = 999424; Warnings: Warning 1287 '@@query_cache_size' is deprecated and will be removed in a future release. SET SESSION query_cache_type = 1; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 Warnings: Warning 1287 '@@query_cache_type' is deprecated and will be removed in a future release. SELECT @@global.query_cache_size; @@global.query_cache_size 999424 Warnings: Warning 1287 '@@query_cache_size' is deprecated and will be removed in a future release. SELECT @@session.query_cache_type; @@session.query_cache_type ON Warnings: Warning 1287 '@@query_cache_type' is deprecated and will be removed in a future release. CREATE TABLE t1 (f1 INT) ENGINE="MyISAM"; INSERT INTO t1 VALUES (1), (2), (3); # show we can't add queries to the cache while tracking: BEGIN; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ SELECT f1 FROM t1 WHERE f1 > 1; f1 2 3 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- Tr____S_ SELECT f1 FROM t1 WHERE f1 > 1; f1 2 3 COMMIT; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SHOW STATUS LIKE 'Qcache_queries_in_cache'; Variable_name Value Qcache_queries_in_cache 0 SET SESSION session_track_transaction_info="OFF"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 SELECT f1 FROM t1 WHERE f1 > 1; f1 2 3 SHOW STATUS LIKE 'Qcache_queries_in_cache'; Variable_name Value Qcache_queries_in_cache 1 SELECT f1 FROM t1 WHERE f1 > 1; f1 2 3 SHOW STATUS LIKE 'Qcache_hits'; Variable_name Value Qcache_hits 1 SET SESSION session_track_transaction_info="STATE"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SHOW STATUS LIKE 'Qcache_queries_in_cache'; Variable_name Value Qcache_queries_in_cache 1 SELECT f1 FROM t1 WHERE f1 > 1; f1 2 3 SHOW STATUS LIKE 'Qcache_hits'; Variable_name Value Qcache_hits 1 RESET QUERY CACHE; Warnings: Warning 1681 'RESET QUERY CACHE' is deprecated and will be removed in a future release. FLUSH STATUS; DROP TABLE t1; SET SESSION query_cache_type = 0; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 Warnings: Warning 1287 '@@query_cache_type' is deprecated and will be removed in a future release. SET GLOBAL query_cache_size = @old_qc_size; Warnings: Warning 1287 '@@query_cache_size' is deprecated and will be removed in a future release. ######################################################################## # # XA # CREATE TABLE t1 (f1 int) ENGINE="InnoDB"; SET SESSION session_track_transaction_info="CHARACTERISTICS"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- # XA ROLLBACK XA START 'test1'; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- XA START 'test1'; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ INSERT t1 VALUES (1); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T___W___ XA END 'test1'; XA PREPARE 'test1'; XA ROLLBACK 'test1'; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # XA COMMIT XA START 'test2', 'yy'; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- XA START 'test2','yy'; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ INSERT t1 VALUES (2); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T___W___ XA END 'test2', 'yy'; XA PREPARE 'test2', 'yy'; XA COMMIT 'test2', 'yy'; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ # XA COMMIT ONE PHASE XA START 'test3','xx',5; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- XA START 'test3','xx',5; -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T_______ INSERT t1 VALUES (3); -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- T___W___ XA END 'test3','xx',5; XA COMMIT 'test3','xx',5 ONE PHASE; -- Tracker : SESSION_TRACK_TRANSACTION_CHARACTERISTICS -- -- Tracker : SESSION_TRACK_TRANSACTION_STATE -- ________ SET SESSION session_track_transaction_info="OFF"; -- Tracker : SESSION_TRACK_STATE_CHANGE -- 1 DROP TABLE t1; ######################################################################## # # cleanup # SET SESSION session_track_system_variables= @old_track_list; SET SESSION session_track_state_change=@old_track_enable; SET SESSION session_track_transaction_info=@old_track_tx;