日志级别为error时不统计慢查询

  1. 手动实测,未复现 error 级别不记录 slow log 的问题;
  2. 引用贴的问题,估计是他看了这块的代码对应的 PR,但那块的逻辑不会导致这个问题。至于为什么不记录 slow_log 应该与 log.level 级别无关。已引用贴中回复了。
mysql> select sleep(3);
+----------+
| sleep(3) |
+----------+
|        0 |
+----------+
1 row in set (3.00 sec)
mysql> select sleep(3);
+----------+
| sleep(3) |
+----------+
|        0 |
+----------+
1 row in set (3.00 sec)
mysql> select sleep(3);
+----------+
| sleep(3) |
+----------+
|        0 |
+----------+
1 row in set (3.00 sec)
mysql> select * from information_schema.cluster_config where `key` like '%log.level%' and TYPE like '%tidb%';
+------+---------------------+-----------+-------+
| TYPE | INSTANCE            | KEY       | VALUE |
+------+---------------------+-----------+-------+
| tidb | 172.16.120.122:6000 | log.level | error |
+------+---------------------+-----------+-------+
1 row in set (0.01 sec)

mysql> 
mysql> select Query from information_schema.cluster_slow_query where Query like '%sleep%';;
+------------------+
| Query            |
+------------------+
| select sleep(3); |
| select sleep(3); |
| select sleep(3); |
+------------------+
3 rows in set (0.00 sec)

mysql> select version();
+--------------------+
| version()          |
+--------------------+
| 5.7.25-TiDB-v6.1.0 |
+--------------------+
1 row in set (0.00 sec)

综上,功能层面不存在这个问题。