1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-22 11:44:34 +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" #include "pg_rman.h"
static int pgBackupDeleteFiles(pgBackup *backup); static int pgBackupDeleteFiles(pgBackup *backup);
static bool checkIfDeletable(pgBackup *backup);
int int
do_delete(pgBackupRange *range, bool force) do_delete(pgBackupRange *range)
{ {
int i; int i;
int ret; int ret;
parray *backup_list; parray *backup_list;
bool do_delete; bool do_delete = false;
bool force_delete;
/* DATE are always required */ /* DATE are always required */
if (!pgBackupRangeIsValid(range)) 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.")); elog(ERROR_SYSTEM, _("No backup list found, can't process any more."));
/* Find backups to be deleted */ /* Find backups to be deleted */
do_delete = false;
force_delete = false;
for (i = 0; i < parray_num(backup_list); i++) for (i = 0; i < parray_num(backup_list); i++)
{ {
pgBackup *backup = (pgBackup *)parray_get(backup_list, i); pgBackup *backup = (pgBackup *)parray_get(backup_list, i);
if(force)
force_delete = checkIfDeletable(backup);
/* delete backup and update status to DELETED */ /* delete backup and update status to DELETED */
if (do_delete || force_delete) if (do_delete)
{ {
/* check for interrupt */ /* check for interrupt */
if (interrupted) if (interrupted)
@ -72,7 +65,6 @@ do_delete(pgBackupRange *range, bool force)
/* cleanup */ /* cleanup */
parray_walk(backup_list, pgBackupFree); parray_walk(backup_list, pgBackupFree);
parray_free(backup_list); parray_free(backup_list);
return 0; return 0;
} }
@ -247,15 +239,3 @@ pgBackupDeleteFiles(pgBackup *backup)
return 0; 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 TimeLineID target_tli;
static bool is_hard_copy = false; static bool is_hard_copy = false;
/* delete configuration */
static bool force;
/* show configuration */ /* show configuration */
static bool show_all = false; static bool show_all = false;
@ -71,8 +68,6 @@ static pgut_option options[] =
{ 'b', 's', "with-serverlog" , &current.with_serverlog , SOURCE_ENV }, { 'b', 's', "with-serverlog" , &current.with_serverlog , SOURCE_ENV },
{ 'b', 'Z', "compress-data" , &current.compress_data , SOURCE_ENV }, { 'b', 'Z', "compress-data" , &current.compress_data , SOURCE_ENV },
{ 'b', 'C', "smooth-checkpoint" , &smooth_checkpoint , 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) */ /* options with only long name (keep-xxx) */
{ 'i', 1, "keep-data-generations" , &keep_data_generations, SOURCE_ENV }, { 'i', 1, "keep-data-generations" , &keep_data_generations, SOURCE_ENV },
{ 'i', 2, "keep-data-days" , &keep_data_days , 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) else if (pg_strcasecmp(cmd, "validate") == 0)
return do_validate(&range); return do_validate(&range);
else if (pg_strcasecmp(cmd, "delete") == 0) else if (pg_strcasecmp(cmd, "delete") == 0)
return do_delete(&range, force); return do_delete(&range);
else else
elog(ERROR_ARGS, "invalid command \"%s\"", cmd); 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); extern int do_show(pgBackupRange *range, bool show_all);
/* in delete.c */ /* 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); extern void pgBackupDelete(int keep_generations, int keep_days);
/* in fetch.c */ /* in fetch.c */