mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 11:57:38 +02:00
WL#2360 Performance schema
Part V: performance schema implementation
This commit is contained in:
parent
a4c3bc618b
commit
67a48e1a4c
285 changed files with 27090 additions and 629 deletions
90
mysql-test/suite/perfschema/t/global_read_lock.test
Normal file
90
mysql-test/suite/perfschema/t/global_read_lock.test
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
# Copyright (C) 2009 Sun Microsystems, Inc
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# 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;
|
||||
|
||||
grant SELECT, UPDATE, LOCK TABLES on performance_schema.* to pfsuser@localhost;
|
||||
flush privileges;
|
||||
|
||||
--echo connect (con1, localhost, pfsuser, , test);
|
||||
connect (con1, localhost, pfsuser, , test);
|
||||
|
||||
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;
|
||||
|
||||
--echo connection default;
|
||||
connection default;
|
||||
|
||||
flush tables with read lock;
|
||||
|
||||
--echo connection con1;
|
||||
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;
|
||||
|
||||
--echo connection default;
|
||||
connection default;
|
||||
|
||||
let $wait_condition= select 1 from performance_schema.EVENTS_WAITS_CURRENT where event_name like "wait/synch/cond/sql/COND_global_read_lock";
|
||||
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# Observe the blocked thread in the performance schema :)
|
||||
select event_name,
|
||||
left(source, locate(":", source)) as short_source,
|
||||
timer_end, timer_wait, operation
|
||||
from performance_schema.EVENTS_WAITS_CURRENT
|
||||
where event_name like "wait/synch/cond/sql/COND_global_read_lock";
|
||||
|
||||
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;
|
||||
|
||||
--echo connection default;
|
||||
connection default;
|
||||
|
||||
drop user pfsuser@localhost;
|
||||
flush privileges;
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue