1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-05 13:20:31 +02:00

Remove undocumented option "force" for delete command

This was in code, not in the docs...
This commit is contained in:
Michael Paquier 2014-01-10 02:57:15 +09:00
parent e04426361f
commit 9cd8e33508
3 changed files with 5 additions and 30 deletions

View File

@ -10,16 +10,14 @@
#include "pg_rman.h"
static int pgBackupDeleteFiles(pgBackup *backup);
static bool checkIfDeletable(pgBackup *backup);
int
do_delete(pgBackupRange *range, bool force)
do_delete(pgBackupRange *range)
{
int i;
int ret;
parray *backup_list;
bool do_delete;
bool force_delete;
bool do_delete = false;
/* DATE are always required */
if (!pgBackupRangeIsValid(range))
@ -39,17 +37,12 @@ do_delete(pgBackupRange *range, bool force)
elog(ERROR_SYSTEM, _("No backup list found, can't process any more."));
/* Find backups to be deleted */
do_delete = false;
force_delete = false;
for (i = 0; i < parray_num(backup_list); i++)
{
pgBackup *backup = (pgBackup *)parray_get(backup_list, i);
if(force)
force_delete = checkIfDeletable(backup);
/* delete backup and update status to DELETED */
if (do_delete || force_delete)
if (do_delete)
{
/* check for interrupt */
if (interrupted)
@ -72,7 +65,6 @@ do_delete(pgBackupRange *range, bool force)
/* cleanup */
parray_walk(backup_list, pgBackupFree);
parray_free(backup_list);
return 0;
}
@ -247,15 +239,3 @@ pgBackupDeleteFiles(pgBackup *backup)
return 0;
}
bool
checkIfDeletable(pgBackup *backup)
{
/* find latest full backup. */
if (backup->status != BACKUP_STATUS_OK &&
backup->status != BACKUP_STATUS_DELETED &&
backup->status != BACKUP_STATUS_DONE)
return true;
return false;
}

View File

@ -47,9 +47,6 @@ static char *target_inclusive;
static TimeLineID target_tli;
static bool is_hard_copy = false;
/* delete configuration */
static bool force;
/* show configuration */
static bool show_all = false;
@ -71,8 +68,6 @@ static pgut_option options[] =
{ 'b', 's', "with-serverlog" , &current.with_serverlog , SOURCE_ENV },
{ 'b', 'Z', "compress-data" , &current.compress_data , SOURCE_ENV },
{ 'b', 'C', "smooth-checkpoint" , &smooth_checkpoint , SOURCE_ENV },
/* delete options */
{ 'b', 'f', "force" , &force , SOURCE_ENV },
/* options with only long name (keep-xxx) */
{ 'i', 1, "keep-data-generations" , &keep_data_generations, SOURCE_ENV },
{ 'i', 2, "keep-data-days" , &keep_data_days , SOURCE_ENV },
@ -201,7 +196,7 @@ main(int argc, char *argv[])
else if (pg_strcasecmp(cmd, "validate") == 0)
return do_validate(&range);
else if (pg_strcasecmp(cmd, "delete") == 0)
return do_delete(&range, force);
return do_delete(&range);
else
elog(ERROR_ARGS, "invalid command \"%s\"", cmd);

View File

@ -244,7 +244,7 @@ extern int do_init(void);
extern int do_show(pgBackupRange *range, bool show_all);
/* in delete.c */
extern int do_delete(pgBackupRange *range, bool force);
extern int do_delete(pgBackupRange *range);
extern void pgBackupDelete(int keep_generations, int keep_days);
/* in fetch.c */