I found the system variable log_throttle_queries_not_using_indexes could not limit the the number of sql wirting in slowlog file.
I have tried 2 release 8.0.32 and the latest image 8.0.36-28, both of them have same issue.
but mysql community edition works with this system variable.
I provide following test case to reproduce the issue:
1: pull images from docker hub:
docker pull percona/percona-server:latest
2, run image
docker run --rm -d -p 3306:3306 --name percona-server -e MYSQL_ROOT_PASSWORD=ChangeMe percona/percona-server:latest
3,login to docker to access db:
docker exec -it percona-server bash
4, login to mysql
mysql -uroot -pChangeMe
5, change parameter for slowlog:
mysql> set global slow_query_log =ON ;
Query OK, 0 rows affected (0.01 sec)
mysql> set global log_slow_admin_statements=on;
Query OK, 0 rows affected (0.00 sec)
mysql> set global min_examined_row_limit=1000;
Query OK, 0 rows affected (0.00 sec)
mysql> set global log_queries_not_using_indexes=on;
Query OK, 0 rows affected (0.00 sec)
mysql> set global log_throttle_queries_not_using_indexes=4;
Query OK, 0 rows affected (0.00 sec)
6, mark down the location of slowlog file:
show variables like ‘slow_query_log_file’;
7, setup test table:
create database kk;
use kk;
CREATE TABLE tab_test (
id int NOT NULL,
name varchar(10) DEFAULT NULL,
address varchar(50) DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB ;
DELIMITER //
CREATE PROCEDURE insertRandomData()
BEGIN
DECLARE i INT DEFAULT 10;
WHILE i <= 10000 DO
INSERT INTO tab_test(id, name, address)
VALUES (i, CONCAT(‘Name’, i), CONCAT(‘Address’, i));
SET i = i + 1;
END WHILE;
END;
//
DELIMITER ;
CALL insertRandomData();
– wait about 30 seconds to generate records.
– then exit db and tail slowlog just mark down. /var/lib/mysql/xxxx-slow.log
exit;
tail -f /var/lib/mysql/xxxx-slow.log
8, open another terminal to login docker and db;
docker exec -it percona-server bash
mysql -uroot -pChangeMe
9, run serval times sql below:
select * from tab_test where address =‘yyyyyyyyyyyyyyy’;
we can see this sql keep rolling in the slowlog tailing in the other terminal.
The mysql community edition works as expected : after run 4 times of the sql. the slowlog stop rolling and 1 min later it came out :
so please help to check whether it is a bug or any other setting we need to fix? Thanks a lot.