mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
SCRUM: 'Replication: PURGE LOGS with date' task
Added: PURGE [MASTER] LOGS BEFORE date/date_expression expire-logs-days option With this option old files are deleted when - mysqld is started - log is rotated - someone does FLUSH LOGS
This commit is contained in:
@@ -256,15 +256,10 @@ bool log_in_use(const char* log_name)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int purge_master_logs(THD* thd, const char* to_log)
|
||||
int purge_error_message(THD* thd, int res)
|
||||
{
|
||||
char search_file_name[FN_REFLEN];
|
||||
const char* errmsg = 0;
|
||||
|
||||
mysql_bin_log.make_log_name(search_file_name, to_log);
|
||||
int res = mysql_bin_log.purge_logs(thd, search_file_name);
|
||||
|
||||
switch(res) {
|
||||
case 0: break;
|
||||
case LOG_INFO_EOF: errmsg = "Target log not found in binlog index"; break;
|
||||
@@ -288,10 +283,26 @@ binlog purge"; break;
|
||||
}
|
||||
else
|
||||
send_ok(thd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int purge_master_logs(THD* thd, const char* to_log)
|
||||
{
|
||||
char search_file_name[FN_REFLEN];
|
||||
|
||||
mysql_bin_log.make_log_name(search_file_name, to_log);
|
||||
int res = mysql_bin_log.purge_logs(thd, search_file_name);
|
||||
|
||||
return purge_error_message(thd, res);
|
||||
}
|
||||
|
||||
|
||||
int purge_master_logs_before_date(THD* thd, time_t purge_time)
|
||||
{
|
||||
int res = mysql_bin_log.purge_logs_before_date(thd, purge_time);
|
||||
return purge_error_message(thd ,res);
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Clean up loop to only have one call to send_file()
|
||||
*/
|
||||
|
Reference in New Issue
Block a user