Server IP : 104.21.38.3 / Your IP : 104.23.175.244 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/perfschema/t/ |
Upload File : |
## ## WL#4818, 4.1.3 MUTEXES, RW-LOCKS, ... ## ## Functional testing of mutexes and RW-locks ## --source include/not_embedded.inc --source include/have_perfschema.inc UPDATE performance_schema.setup_instruments SET enabled = 'NO', timed = 'YES'; UPDATE performance_schema.setup_instruments SET enabled = 'YES' WHERE name LIKE 'wait/synch/mutex/%' OR name LIKE 'wait/synch/rwlock/%'; # reset lost counters truncate table performance_schema.events_statements_summary_by_digest; flush status; # Make sure objects are instrumented select NAME from performance_schema.mutex_instances where NAME = 'wait/synch/mutex/sql/LOCK_open'; select NAME from performance_schema.rwlock_instances where NAME = 'wait/synch/rwlock/sql/LOCK_grant' limit 1; --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings # # TODO: Change to InnoDB when it gets instrumentation # CREATE TABLE t1 (id INT PRIMARY KEY, b CHAR(100) DEFAULT 'initial value') ENGINE=MyISAM; INSERT INTO t1 (id) VALUES (1), (2), (3), (4), (5), (6), (7), (8); # # FM1: Count for mutex should increase with instrumentation enabled and # FM2: Count for mutex should not increase with instrumentation disabled # TRUNCATE TABLE performance_schema.events_waits_history_long; TRUNCATE TABLE performance_schema.events_waits_history; TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache')); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_timed; UPDATE performance_schema.setup_instruments SET enabled = 'NO' WHERE NAME = 'wait/synch/mutex/sql/LOCK_table_cache'; TRUNCATE TABLE performance_schema.events_waits_history_long; TRUNCATE TABLE performance_schema.events_waits_history; TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/mutex/sql/LOCK_table_cache')); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_timed; # # Repeat for RW-lock # TRUNCATE TABLE performance_schema.events_waits_history_long; TRUNCATE TABLE performance_schema.events_waits_history; TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT IF((@after_count - @before_count) > 0, 'Success', 'Failure') test_fm1_rw_timed; UPDATE performance_schema.setup_instruments SET enabled = 'NO' WHERE NAME = 'wait/synch/rwlock/sql/LOCK_grant'; TRUNCATE TABLE performance_schema.events_waits_history_long; TRUNCATE TABLE performance_schema.events_waits_history; TRUNCATE TABLE performance_schema.events_waits_current; SELECT * FROM t1 WHERE id = 1; SET @before_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT * FROM t1; SET @after_count = (SELECT SUM(TIMER_WAIT) FROM performance_schema.events_waits_history_long WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_grant')); SELECT IF((COALESCE(@after_count, 0) - COALESCE(@before_count, 0)) = 0, 'Success', 'Failure') test_fm2_rw_timed; # Clean-up. UPDATE performance_schema.setup_instruments SET enabled = 'YES'; DROP TABLE t1; UPDATE performance_schema.setup_instruments SET enabled = 'YES', timed = 'YES'; # In case of failure, will indicate the root cause show global status like "performance_schema%";