pingcap/tidb

support for FLUSH LOGS command

Open

#19,643 opened on Sep 1, 2020

View on GitHub
 (7 comments) (1 reaction) (0 assignees)Go (6,186 forks)batch import
feature/acceptedhelp wantedtype/feature-request

Repository metrics

Stars
 (40,090 stars)
PR merge metrics
 (Avg merge 14d 4h) (346 merged PRs in 30d)

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)


MySQL [(none)]> system ls /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
ls: 无法访问/home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log: 没有那个文件或目录
MySQL [(none)]> select sleep(3);
+----------+
| sleep(3) |
+----------+
|        0 |
+----------+
1 row in set (3.00 sec)

MySQL [(none)]> system ls /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
/home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
MySQL [(none)]> system rm /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
MySQL [(none)]> system ls /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
ls: 无法访问/home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log: 没有那个文件或目录
MySQL [(none)]> select sleep(3);
+----------+
| sleep(3) |
+----------+
|        0 |
+----------+
1 row in set (3.00 sec)

MySQL [(none)]> system ls /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
ls: 无法访问/home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log: 没有那个文件或目录

MySQL [(none)]> system touch /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
MySQL [(none)]> select sleep(3);
+----------+
| sleep(3) |
+----------+
|        0 |
+----------+
1 row in set (3.01 sec)

MySQL [(none)]> system cat /home/tidb/gangshen/dev/deploy/tidb-14010/log/tidb_slow_query.log
MySQL [(none)]>

TiDB will automatically create a slow log file if it finds no slow log file when it encounters a slow log for the first time after restarting. Later, if the slow log is manually deleted after the slow log is created, it will not be created actively even if the slow log appears, and it needs to be restarted.

2. What did you expect to see? (Required)

tidb-server will create tidb_slow_query.log if it not exists.

3. What did you see instead (Required)

tidb-server won't create tidb_slow_query.log after remove it

4. What is your TiDB version? (Required)


+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                                     |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v4.0.5
Edition: Community
Git Commit Hash: 9c1c21270001a0084dcb5d842c50e1fbea5d1fa8
Git Branch: heads/refs/tags/v4.0.5
UTC Build Time: 2020-08-28 10:07:42
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

Contributor guide