mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 03:09:04 +00:00
PT-81 Collect information about locks and transactions using P_S
This commit is contained in:
29
t/pt-stalk/samples/issue-1642751.sql
Normal file
29
t/pt-stalk/samples/issue-1642751.sql
Normal 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;
|
Reference in New Issue
Block a user