[MDEV-22800] Support PURGE BINARY LOGS TO with non-constant parameter in procedure code somehow Created: 2020-06-04  Updated: 2020-07-06

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: 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 ...


Generated at Thu Feb 08 09:17:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.