From 9cd8e33508c3d1a2eabc6c754a4de4d1a5bce3fc Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Fri, 10 Jan 2014 02:57:15 +0900 Subject: [PATCH] Remove undocumented option "force" for delete command This was in code, not in the docs... --- delete.c | 26 +++----------------------- pg_rman.c | 7 +------ pg_rman.h | 2 +- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/delete.c b/delete.c index c34acc6b..fe057fac 100644 --- a/delete.c +++ b/delete.c @@ -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; -} diff --git a/pg_rman.c b/pg_rman.c index 8ccf07a7..08360472 100644 --- a/pg_rman.c +++ b/pg_rman.c @@ -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" , ¤t.with_serverlog , SOURCE_ENV }, { 'b', 'Z', "compress-data" , ¤t.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); diff --git a/pg_rman.h b/pg_rman.h index afcc601f..235c5c86 100644 --- a/pg_rman.h +++ b/pg_rman.h @@ -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 */