Skip to content

Commit e044263

Browse files
author
Michael Paquier
committed
Allow only one keep parameter to trigger log and archive deletion
Same as previously, having two satisfy two conditions where most of the users will just look for one policy usually is kind of awkward.
1 parent fcaae1a commit e044263

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

backup.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,8 +1345,8 @@ delete_old_files(const char *root,
13451345
root, files_str, days_str);
13461346
}
13471347

1348-
/* delete files which satisfy both conditions */
1349-
if (keep_files == KEEP_INFINITE || keep_days == KEEP_INFINITE)
1348+
/* Leave if both settings are set to infinite, there is nothing to do */
1349+
if (keep_files == KEEP_INFINITE && keep_days == KEEP_INFINITE)
13501350
{
13511351
elog(LOG, "%s() infinite", __FUNCTION__);
13521352
return;
@@ -1358,6 +1358,7 @@ delete_old_files(const char *root,
13581358
pgFile *file = (pgFile *) parray_get(files, i);
13591359

13601360
elog(LOG, "%s() %s", __FUNCTION__, file->path);
1361+
13611362
/* Delete completed WALs only. */
13621363
if (is_arclog && !xlog_is_complete_wal(file))
13631364
{
@@ -1377,10 +1378,7 @@ delete_old_files(const char *root,
13771378
file->mtime, days_threshold);
13781379
continue;
13791380
}
1380-
elog(LOG, "%s() %lu is older than %lu", __FUNCTION__,
1381-
file->mtime, days_threshold);
1382-
1383-
if (file_num <= keep_files)
1381+
else if (file_num <= keep_files)
13841382
{
13851383
elog(LOG, "%s() newer files are only %d", __FUNCTION__, file_num);
13861384
continue;

pg_rman.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,15 @@ absolute paths; relative paths are not allowed.
263263
Specify how long backuped archive WAL files will be kept.
264264
--keep-arclog-files means number of backup files.
265265
--keep-arclog-days means days to be kept. When backup is run, only
266-
files exceeded both settings are deleted from archive storage.
266+
files exceeded one of those settings are deleted from archive storage.
267267

268268
--keep-srvlog-files / --keep-srvlog-days
269269
Specify how long backuped serverlog files will be kept.
270270
--keep-srvlog-files means number of backup files.
271271
--keep-srvlog-days means days to be kept.
272-
When backup is run, only files exceeded both settings are deleted
273-
from server log directory (log_directory). This option works when
274-
you specify --with-serverlog and --srvlog-path options in backup
272+
When backup is run, only files exceeded one of those settings are
273+
deleted from server log directory (log_directory). This option works
274+
when you specify --with-serverlog and --srvlog-path options in backup
275275
command.
276276

277277
- Restore options

0 commit comments

Comments
 (0)