Bug #72529 rm a large slow log file and then flush slow logs, the mysqld will hang
Submitted: 4 May 2014 10:13 Modified: 4 May 2014 11:21
Reporter: Hao Liu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S5 (Performance)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any

[4 May 2014 10:13] Hao Liu
Description:
I have a mysqld instance with a large slow log file. Then I execute the command 'rm slow_log' in shell, and execute the flush slow logs in mysql client, the mysqld will hang a while and the tps/qps will fall. 

How to repeat:
1. Generate a large slow log file(such as 10G ), you can set the long_query_time = 0 to do it;
2. rm slow log file in bash;
3. Execute the command 'flush slow logs' in mysql client;
4. You will watch the tps/qps to fall down much.

Suggested fix:
I think there are two questions for the problem:
1. file system cache, maybe we can call "posix_fadvise(file, 0, 0, POSIX_FADV_DONTNEED)"  after mysql_file_open to avoid caching log file content;

2. split the LOCK_log to different locks for binlog/slow_log/general_logļ¼›
[4 May 2014 11:21] MySQL Verification Team
Thanks for the report. Related: 

https://dev.mysql.com/worklog/task/?id=6613
(WL#6613: Refactor logging code - split logging and binlogging code)