mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-29 01:46:31 +01:00 
			
		
		
		
	 775cba4d0f
			
		
	
	
	775cba4d0f
	
	
	
		
			
			- FLUSH GLOBAL STATUS now resets most global_status_vars.
  At this stage, this is mainly to be used for testing.
- FLUSH SESSION STATUS added as an alias for FLUSH STATUS.
- FLUSH STATUS does not require any privilege (before required RELOAD).
- FLUSH GLOBAL STATUS requires RELOAD privilege.
- All global status reset moved to FLUSH GLOBAL STATUS.
- Replication semisync status variables are now reset by
  FLUSH GLOBAL STATUS.
- In test cases, the only changes are:
  - Replace FLUSH STATUS with FLUSH GLOBAL STATUS
  - Replace FLUSH STATUS with FLUSH STATUS; FLUSH GLOBAL STATUS.
    This was only done in a few tests where the test was using SHOW STATUS
    for both local and global variables.
- Uptime_since_flush_status is now always provided, independent if
  ENABLED_PROFILING is enabled when compiling MariaDB.
- @@global.Uptime_since_flush_status is reset on FLUSH GLOBAL STATUS
  and @@session.Uptime_since_flush_status is reset on FLUSH SESSION STATUS.
- When connected, @@session.Uptime_since_flush_status is set to 0.
		
	
			
		
			
				
	
	
		
			134 lines
		
	
	
	
		
			4.6 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			134 lines
		
	
	
	
		
			4.6 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| ##
 | |
| ## 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 global status;
 | |
| 
 | |
| # Make sure objects are instrumented
 | |
| select NAME from performance_schema.mutex_instances
 | |
|   where NAME = 'wait/synch/mutex/mysys/THR_LOCK::mutex' GROUP BY NAME;
 | |
| 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/mysys/THR_LOCK::mutex'));
 | |
| 
 | |
| SELECT * FROM t1;
 | |
| 
 | |
| SET @after_count = (SELECT SUM(TIMER_WAIT)
 | |
|                     FROM performance_schema.events_waits_history_long
 | |
|                     WHERE (EVENT_NAME = 'wait/synch/mutex/mysys/THR_LOCK::mutex'));
 | |
| 
 | |
| 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/mysys/THR_LOCK::mutex';
 | |
| 
 | |
| 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/mysys/THR_LOCK::mutex'));
 | |
| 
 | |
| SELECT * FROM t1;
 | |
| 
 | |
| SET @after_count = (SELECT SUM(TIMER_WAIT)
 | |
|                     FROM performance_schema.events_waits_history_long
 | |
|                     WHERE (EVENT_NAME = 'wait/synch/mutex/mysys/THR_LOCK::mutex'));
 | |
| 
 | |
| 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;
 | |
| 
 | |
| show variables like "%not_found%";
 | |
| 
 | |
| SET @before_count = (SELECT SUM(TIMER_WAIT)
 | |
|                      FROM performance_schema.events_waits_history_long
 | |
|                      WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
 | |
| 
 | |
| show variables like "%not_found%";
 | |
| 
 | |
| SET @after_count = (SELECT SUM(TIMER_WAIT)
 | |
|                     FROM performance_schema.events_waits_history_long
 | |
|                     WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
 | |
| 
 | |
| 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_system_variables_hash';
 | |
| 
 | |
| TRUNCATE TABLE performance_schema.events_waits_history_long;
 | |
| TRUNCATE TABLE performance_schema.events_waits_history;
 | |
| TRUNCATE TABLE performance_schema.events_waits_current;
 | |
| 
 | |
| show variables like "%not_found%";
 | |
| 
 | |
| SET @before_count = (SELECT SUM(TIMER_WAIT)
 | |
|                      FROM performance_schema.events_waits_history_long
 | |
|                      WHERE (EVENT_NAME = 'wait/synch/rwlock/sql/LOCK_system_variables_hash'));
 | |
| 
 | |
| show variables like "%not_found%";
 | |
| 
 | |
| SET @after_count = (SELECT SUM(TIMER_WAIT)
 | |
|                     FROM performance_schema.events_waits_history_long
 | |
|                     WHERE (EVENT_NAME = 'LOCK_system_variables_hash'));
 | |
| 
 | |
| 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%";
 | |
| 
 |