Commit ea0b1ccd authored by Sergei Golubchik's avatar Sergei Golubchik

Revert "MDEV-29091: Correct event_name in PFS for wait caused by FOR UPDATE"

This reverts commit 03c9a4ef.

The fix is wrong. It was doing this: if the uninitialized
wait->m_class has some specific value, then don't initialize it.
parent c378efee
SET default_storage_engine=InnoDB;
SELECT @save_instrument_enabled := ENABLED
, @save_instrument_timed := TIMED
FROM performance_schema.setup_instruments
WHERE NAME = 'wait/lock/table/sql/handler';
@save_instrument_enabled := ENABLED @save_instrument_timed := TIMED
YES YES
SELECT @save_consumer_enabled := ENABLED
FROM performance_schema.setup_consumers
WHERE NAME = 'events_waits_current';
@save_consumer_enabled := ENABLED
YES
UPDATE performance_schema.setup_instruments
SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'wait/lock/table/sql/handler';
UPDATE performance_schema.setup_consumers
SET ENABLED = 'YES'
WHERE NAME = 'events_waits_current';
CREATE TABLE t1 (id1 INT(11), col1 VARCHAR (200));
INSERT INTO t1 VALUES (1, 'aa');
INSERT INTO t1 VALUES (2, 'bb');
connect con1,localhost,root,,test;
connect con2,localhost,root,,test;
connection con1;
START TRANSACTION;
connection con2;
START TRANSACTION;
SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE;
connection default;
SELECT event_name FROM performance_schema.events_waits_current
WHERE event_name LIKE '%wait/lock/table/sql/handler%';
event_name
UPDATE performance_schema.setup_instruments
SET ENABLED = @save_instrument_enabled, TIMED = @save_instrument_timed
WHERE NAME = 'wait/lock/table/sql/handler';
UPDATE performance_schema.setup_consumers
SET ENABLED = @save_consumer_enabled
WHERE NAME = 'events_waits_current';
disconnect con1;
disconnect con2;
DROP TABLE t1;
#
# proper event name wait/lock/table/sql/handler recorded in
# PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. Before this fix, it was
# labeled as wait/io/table/sql/handler.
#
--source include/have_innodb.inc
--source include/have_perfschema.inc
--source include/not_embedded.inc
SET default_storage_engine=InnoDB;
SELECT @save_instrument_enabled := ENABLED
, @save_instrument_timed := TIMED
FROM performance_schema.setup_instruments
WHERE NAME = 'wait/lock/table/sql/handler';
SELECT @save_consumer_enabled := ENABLED
FROM performance_schema.setup_consumers
WHERE NAME = 'events_waits_current';
UPDATE performance_schema.setup_instruments
SET ENABLED = 'YES', TIMED = 'YES'
WHERE NAME = 'wait/lock/table/sql/handler';
UPDATE performance_schema.setup_consumers
SET ENABLED = 'YES'
WHERE NAME = 'events_waits_current';
CREATE TABLE t1 (id1 INT(11), col1 VARCHAR (200));
INSERT INTO t1 VALUES (1, 'aa');
INSERT INTO t1 VALUES (2, 'bb');
connect (con1,localhost,root,,test);
connect (con2,localhost,root,,test);
connection con1;
START TRANSACTION;
let $wait_condition=
SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE;
--source include/wait_condition.inc
connection con2;
START TRANSACTION;
send SELECT id1 FROM t1 WHERE id1=1 FOR UPDATE;
connection default;
SELECT event_name FROM performance_schema.events_waits_current
WHERE event_name LIKE '%wait/lock/table/sql/handler%';
# clean up
UPDATE performance_schema.setup_instruments
SET ENABLED = @save_instrument_enabled, TIMED = @save_instrument_timed
WHERE NAME = 'wait/lock/table/sql/handler';
UPDATE performance_schema.setup_consumers
SET ENABLED = @save_consumer_enabled
WHERE NAME = 'events_waits_current';
disconnect con1;
disconnect con2;
DROP TABLE t1;
......@@ -3068,8 +3068,7 @@ pfs_start_table_io_wait_v1(PSI_table_locker_state *state,
PFS_table_share *share= pfs_table->m_share;
wait->m_thread_internal_id= pfs_thread->m_thread_internal_id;
if (wait->m_class == NULL || wait->m_class->m_type != PFS_CLASS_TABLE_LOCK)
wait->m_class= &global_table_io_class;
wait->m_class= &global_table_io_class;
wait->m_timer_start= timer_start;
wait->m_timer_end= 0;
wait->m_object_instance_addr= pfs_table->m_identity;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment