Skip to content

Conversation

abg
Copy link

@abg abg commented Jul 31, 2025

Fix stall during audit log rotation when using ASYNCHRONOUS or PERFORMANCE buffering strategies. The rotation process could be delayed by up to one second while holding the m_write_lock mutex.

mysql> do audit_log_rotate();
Query OK, 0 rows affected (0.99 sec)

The issue occurs when log rotation calls FileWriterBuffering::close() and the flush worker thread was sleeping in mysql_cond_timedwait. The close method waits for the flush worker to clear the buffer, but that worker thread might not wake up for up to one second causing unnecessary delay.

Signal the flush worker thread immediately before waiting in close to ensure prompt processing of any remaining buffered data and prevent rotation stalls.

@hulyav hulyav changed the title PS-9836 [8.4] Fix audit log rotation stall in buffered strategies PS-10131 [8.4] Fix audit log rotation stall in buffered strategies Aug 25, 2025
Fix stall during audit log rotation when using ASYNCHRONOUS or
PERFORMANCE buffering strategies. The rotation process could be delayed
by up to one second while holding the m_write_lock mutex.

```
mysql> do audit_log_rotate();
Query OK, 0 rows affected (0.99 sec)
```

The issue occurs when log rotation calls FileWriterBuffering::close()
and the flush worker thread was sleeping in mysql_cond_timedwait. The
close method waits for the flush worker to clear the buffer, but that
worker thread might not wake up for up to one second causing unnecessary
delay.

Signal the flush worker thread immediately before waiting in close to
ensure prompt processing of any remaining buffered data and prevent
rotation stalls.
@abg abg force-pushed the PS-9836-audit-log-rotation-stalls branch from 2afe0e1 to fd741f4 Compare September 5, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant