mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
1fc5777320
- Updated slow_query_log_file_basic and general_log_file basis instead of the func version as the func version run good but the basic versions fail. - Sent innodb.test to dev@innodb.com. - variables.test has differences probably due to a bug in mtr or in the SET statement (see bug#39369). - general_log_file_basic.test and slow_query_log_file_bsaic.test have differences, which might be produced by the new mtr (see bug#38124).
168 lines
5.7 KiB
Text
168 lines
5.7 KiB
Text
################# mysql-test\t\innodb_max_dirty_pages_pct_func.test ##########
|
|
# #
|
|
# Variable Name: innodb_max_dirty_pages_pct #
|
|
# Scope: GLOBAL #
|
|
# Access Type: Dynamic #
|
|
# Data Type: Numeric #
|
|
# Default Value: 90 #
|
|
# Range: 0-100 #
|
|
# #
|
|
# #
|
|
# Creation Date: 2008-03-08 #
|
|
# Author: Rizwan #
|
|
# #
|
|
# Description: #
|
|
# Test cases of Dynamic System Variable innodb_max_dirty_pages_pct that #
|
|
# checks the behavior of this variable #
|
|
# #
|
|
# Reference: #
|
|
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
|
|
# #
|
|
###############################################################################
|
|
|
|
--source include/have_innodb.inc
|
|
|
|
SET @start_value= @@global.innodb_max_dirty_pages_pct;
|
|
|
|
--echo '#--------------------FN_DYNVARS_044_02-------------------------#'
|
|
############################################################################
|
|
# Check if setting innodb_max_dirty_pages_pct is changed in new connection #
|
|
############################################################################
|
|
|
|
SET @@global.innodb_max_dirty_pages_pct = 80;
|
|
--echo 'connect (con1,localhost,root,,,,)'
|
|
connect (con1,localhost,root,,,,);
|
|
SELECT @@global.innodb_max_dirty_pages_pct;
|
|
SET @@global.innodb_max_dirty_pages_pct = 70;
|
|
--echo 'connect (con2,localhost,root,,,,)'
|
|
connect (con2,localhost,root,,,,);
|
|
SELECT @@global.innodb_max_dirty_pages_pct;
|
|
disconnect con2;
|
|
disconnect con1;
|
|
|
|
--echo '#--------------------FN_DYNVARS_044_02-------------------------#'
|
|
###################################################################
|
|
# Begin the functionality Testing of innodb_max_dirty_pages_pct #
|
|
###################################################################
|
|
|
|
--echo 'connection default'
|
|
connection default;
|
|
|
|
--disable_query_log
|
|
|
|
--disable_warnings
|
|
DROP PROCEDURE IF EXISTS add_records;
|
|
DROP PROCEDURE IF EXISTS add_until;
|
|
DROP PROCEDURE IF EXISTS check_pct;
|
|
DROP FUNCTION IF EXISTS dirty_pct;
|
|
DROP TABLE IF EXISTS t1;
|
|
--enable_warnings
|
|
|
|
CREATE TABLE t1(
|
|
a INT AUTO_INCREMENT PRIMARY KEY,
|
|
b CHAR(200)
|
|
)ENGINE=INNODB;
|
|
|
|
DELIMITER //;
|
|
CREATE PROCEDURE add_records(IN NUM INT)
|
|
BEGIN
|
|
START TRANSACTION;
|
|
WHILE (NUM>0) DO
|
|
INSERT INTO t1(b) VALUES('MYSQL');
|
|
SET NUM = NUM - 1;
|
|
END WHILE;
|
|
COMMIT;
|
|
END//
|
|
|
|
CREATE FUNCTION dirty_pct() RETURNS DECIMAL(20,17)
|
|
BEGIN
|
|
DECLARE res DECIMAL(20,17);
|
|
DECLARE a1,b1 VARCHAR(256);
|
|
DECLARE a2,b2 VARCHAR(256);
|
|
DECLARE dirty CURSOR FOR SELECT * FROM information_schema.global_status
|
|
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty'
|
|
UNION SELECT * FROM information_schema.session_status
|
|
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_dirty';
|
|
DECLARE total CURSOR FOR SELECT * FROM information_schema.global_status
|
|
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total'
|
|
UNION SELECT * FROM information_schema.session_status
|
|
WHERE variable_name LIKE 'Innodb_buffer_pool_pages_total';
|
|
|
|
OPEN dirty;
|
|
OPEN total;
|
|
|
|
FETCH dirty INTO a1, b1;
|
|
FETCH total INTO a2, b2;
|
|
|
|
SET res = ( CONVERT(b1,DECIMAL)*100)/CONVERT(b2,DECIMAL);
|
|
|
|
CLOSE dirty;
|
|
CLOSE total;
|
|
RETURN res;
|
|
END//
|
|
|
|
CREATE PROCEDURE add_until(IN NUM DECIMAL)
|
|
BEGIN
|
|
DECLARE pct,last DECIMAL(20,17);
|
|
|
|
SET pct = dirty_pct();
|
|
SET last = 0;
|
|
WHILE (pct>NUM and pct<100) DO
|
|
CALL add_records(500);
|
|
SET pct = dirty_pct();
|
|
IF (pct<last) THEN
|
|
SET pct = NUM+1;
|
|
ELSE
|
|
SET last = pct;
|
|
END IF;
|
|
END WHILE;
|
|
END//
|
|
|
|
CREATE PROCEDURE check_pct(IN NUM DECIMAL)
|
|
BEGIN
|
|
IF (dirty_pct() < NUM) THEN
|
|
SELECT 'BELOW_MAX' AS PCT_VALUE;
|
|
ELSE
|
|
SELECT 'ABOVE_MAX' AS PCT_VALUE;
|
|
END IF;
|
|
END//
|
|
|
|
DELIMITER ;//
|
|
|
|
--enable_query_log
|
|
|
|
#==========================================================
|
|
--echo '---Check when innodb_max_dirty_pages_pct is 10---'
|
|
#==========================================================
|
|
|
|
SET @@global.innodb_max_dirty_pages_pct = 10;
|
|
|
|
FLUSH STATUS;
|
|
|
|
# Add rows until dirty pages pct is less than this value
|
|
CALL add_until(10);
|
|
|
|
# Give the server some time to flush dirty pages
|
|
FLUSH TABLES;
|
|
CALL add_records(500);
|
|
|
|
# Execute dirty_pct (wait) until dirty pages < 10%
|
|
# Use polling to execute dirty_pct ina loop
|
|
let $wait_condition= SELECT dirty_pct() < 10;
|
|
--source include/wait_condition.inc
|
|
|
|
--echo 'We expect dirty pages pct to be BELOW_MAX'
|
|
CALL check_pct(10);
|
|
|
|
DROP PROCEDURE add_records;
|
|
DROP PROCEDURE add_until;
|
|
DROP PROCEDURE check_pct;
|
|
DROP FUNCTION dirty_pct;
|
|
DROP TABLE t1;
|
|
|
|
SET @@global.innodb_max_dirty_pages_pct= @start_value;
|
|
|
|
##################################################################
|
|
# End of functionality Testing for innodb_max_dirty_pages_pct #
|
|
##################################################################
|
|
|