Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Right now PURGE BINARY LOGS TO apparently can only be used in a stored procedure with static filename string as parameter.
I'd like to create a procedure that only keeps the last N binary log files, and purges any extra binlog files beyond that.
For this I'd need to determine the name of the oldest log name I want to keep, and then somehow need to pass this into the PURGE statement.
But:
- PURGE does not accept a simple @ user variable as argument here
- PURGE inside a procedure does not accept a procedure variable containing the file name either
- PURGE is not supported by PREPARE/EXECUTE either
So all three possible ways to pass in a binlog file name from a variable do not work here.
Being able to run PURGE BINARY LOGS TO ...calculated_filename... looks like something that *should* be possible from within a stored procedure somehow, e.g. to perform such purges from within the server using EVENTs, instead of having to fall back to external scripts and cron jobs to do this ...