Bug #44150 non-blocking PURGE MASTER LOGS
Submitted: 8 Apr 2009 12:53
Reporter: Matthew Lord Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version: OS:Any
Assigned to: Luis Soares CPU Architecture:Any

[8 Apr 2009 12:53] Matthew Lord
Description:
Currently, for both of the following statements all binary log writes are
blocked:
PURGE MASTER LOGS TO
PURGE MASTER LOGS FROM

This mutex is taken and held during the execution of both operations:
pthread_mutex_lock(&LOCK_index);

In the code for MYSQL_LOG:purge_logs there is at least a built in option
to NOT take this mutex (need_mutex) but it's currently always used ( it
gets called with need_mutex =1).  There is currently no option to NOT get
this mutex in MYSQL_LOG:purge_logs_before_date.

In the end both types of statements currently block all binary log writes
during the purge operation.

How to repeat:
N/A

Suggested fix:
Eliminate this mutex and use a system lock on the .index file, possibly?
[10 May 2019 7:35] Erlend Dahl
Bug#71901 rotate + purge binlog lead to stall

was marked as a duplicate.
[21 Apr 2020 17:11] MySQL Verification Team
https://bugs.mysql.com/bug.php?id=99315 marked as duplicate of this one.