diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/perfschema/t/global_read_lock.test | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/perfschema/t/global_read_lock.test')
-rw-r--r-- | mysql-test/suite/perfschema/t/global_read_lock.test | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/t/global_read_lock.test b/mysql-test/suite/perfschema/t/global_read_lock.test new file mode 100644 index 00000000..430d6eed --- /dev/null +++ b/mysql-test/suite/perfschema/t/global_read_lock.test @@ -0,0 +1,78 @@ +# Tests for PERFORMANCE_SCHEMA +# +# Test the effect of a flush tables with read lock on setup_ tables. + +--source include/not_embedded.inc +--source include/have_perfschema.inc + +use performance_schema; + +# Make test robust against errors in other tests. +# Ensure that instrumentation is turned on when we create new connection. +update performance_schema.setup_instruments set enabled='YES'; + +create user pfsuser@localhost; +grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost; +flush privileges; + +connect (con1, localhost, pfsuser, ,"*NO-ONE*"); + +lock tables performance_schema.setup_instruments read; +--disable_result_log +select * from performance_schema.setup_instruments; +--enable_result_log +unlock tables; + +lock tables performance_schema.setup_instruments write; +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; +unlock tables; + +connection default; + +flush tables with read lock; + +connection con1; + +lock tables performance_schema.setup_instruments read; +--disable_result_log +select * from performance_schema.setup_instruments; +--enable_result_log +unlock tables; + +# This will block +--send +lock tables performance_schema.setup_instruments write; + +connection default; + +let $wait_condition= select 1 from performance_schema.events_waits_current where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status"; + +--source include/wait_condition.inc + +# Observe the blocked thread in the performance schema :) +select event_name, + left(source, locate(":", source)) as short_source, + if(timer_end IS NULL, NULL, "SET") as timer_end, + if(timer_wait IS NULL, NULL, "SET") as timer_wait, + operation + from performance_schema.events_waits_current + where event_name like "wait/synch/cond/sql/MDL_context::COND_wait_status"; + +unlock tables; + +connection con1; +--reap + +update performance_schema.setup_instruments set enabled='NO'; +update performance_schema.setup_instruments set enabled='YES'; +unlock tables; + +disconnect con1; +--source include/wait_until_disconnected.inc + +connection default; + +drop user pfsuser@localhost; +flush privileges; + |