PT-81 Collect information about locks and transactions using P_S

This commit is contained in:
Carlos Salguero
2017-03-21 13:45:59 -03:00
parent b6bcf888e6
commit 4a056cf3b0
5 changed files with 95 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
/* This enables perfomance schema without a server restart */
UPDATE performance_schema.setup_consumers SET enabled='YES' WHERE NAME = 'events_waits_current';
/* Enable instrumentation */
UPDATE performance_schema.setup_consumers SET ENABLED='YES' WHERE NAME LIKE '%events_transactions%';
UPDATE performance_schema.setup_consumers SET ENABLED='YES' WHERE NAME LIKE '%events_transactions%';
UPDATE performance_schema.setup_instruments SET ENABLED='YES' WHERE NAME = 'wait/lock/metadata/sql/mdl';
CREATE SCHEMA IF NOT EXISTS test;
USE test;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (id int) ENGINE=INNODB;
/* Successfuly finished transaction */
SET autocommit=0;
START TRANSACTION;
INSERT INTO t1 VALUES (CEIL(RAND()*10000));
COMMIT;
/* Ongoing transaction */
SET autocommit=0;
START TRANSACTION;
INSERT INTO t1 VALUES (CEIL(RAND()*10000));
/* Wait to let pt-stalk to collect the data and find an ACTIVE transaction */
SELECT SLEEP(11);
COMMIT;
DROP DATABASE IF EXISTS test;