Skip to content

Commit 3eb1013

Browse files
committed
Exclude pg_log by default and add option for start beckup.
1 parent 589d8dd commit 3eb1013

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

dir.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const char *pgdata_exclude[] =
2828
NULL, /* arclog_path will be set later */
2929
NULL, /* 'pg_tblspc' will be set later */
3030
NULL, /* sentinel */
31+
NULL
3132
};
3233

3334
static pgFile *pgFileNew(const char *path, bool omit_symlink);

expected/option.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ Common Options:
1818
-c, --check show what would have been done
1919
-j, --threads=NUM num threads for backup and restore
2020
--stream use stream for save/restore WAL during backup
21-
--disable-ptrack-clear disable clear ptrack for postgres without ptrack
2221

2322
Backup options:
2423
-b, --backup-mode=MODE full,page,ptrack
2524
-C, --smooth-checkpoint do smooth checkpoint before backup
2625
--validate validate backup after taking it
2726
--keep-data-generations=N keep GENERATION of full data backup
2827
--keep-data-days=DAY keep enough data backup to recover to DAY days age
28+
--disable-ptrack-clear disable clear ptrack for postgres without ptrack
29+
--backup-pg-log start backup pg_log directory
2930

3031
Restore options:
3132
--recovery-target-time time stamp up to which recovery will proceed

pg_arman.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static int keep_data_days = KEEP_INFINITE;
3737
int num_threads = 1;
3838
bool stream_wal = false;
3939
bool disable_ptrack_clear = false;
40+
static bool backup_logs = false;
4041
static bool backup_validate = false;
4142

4243
/* restore configuration */
@@ -60,9 +61,10 @@ static pgut_option options[] =
6061
/* common options */
6162
{ 'b', 'c', "check", &check },
6263
{ 'i', 'j', "threads", &num_threads },
63-
{ 'b', 8, "stream", &stream_wal },
64-
{ 'b', 9, "disable-ptrack-clear", &disable_ptrack_clear },
64+
{ 'b', 8, "stream", &stream_wal },
6565
/* backup options */
66+
{ 'b', 9, "disable-ptrack-clear", &disable_ptrack_clear },
67+
{ 'b', 10, "backup-pg-log", &backup_logs },
6668
{ 'f', 'b', "backup-mode", opt_backup_mode, SOURCE_ENV },
6769
{ 'b', 'C', "smooth-checkpoint", &smooth_checkpoint, SOURCE_ENV },
6870
/* options with only long name (keep-xxx) */
@@ -175,6 +177,9 @@ main(int argc, char *argv[])
175177
if (arclog_path)
176178
pgdata_exclude[i++] = arclog_path;
177179

180+
if(!backup_logs)
181+
pgdata_exclude[i++] = "pg_log";
182+
178183
/* do actual operation */
179184
if (pg_strcasecmp(cmd, "init") == 0)
180185
return do_init();
@@ -234,13 +239,14 @@ pgut_help(bool details)
234239
printf(_(" -c, --check show what would have been done\n"));
235240
printf(_(" -j, --threads=NUM num threads for backup and restore\n"));
236241
printf(_(" --stream use stream for save/restore WAL during backup\n"));
237-
printf(_(" --disable-ptrack-clear disable clear ptrack for postgres without ptrack\n"));
238242
printf(_("\nBackup options:\n"));
239243
printf(_(" -b, --backup-mode=MODE full,page,ptrack\n"));
240244
printf(_(" -C, --smooth-checkpoint do smooth checkpoint before backup\n"));
241245
printf(_(" --validate validate backup after taking it\n"));
242246
printf(_(" --keep-data-generations=N keep GENERATION of full data backup\n"));
243247
printf(_(" --keep-data-days=DAY keep enough data backup to recover to DAY days age\n"));
248+
printf(_(" --disable-ptrack-clear disable clear ptrack for postgres without ptrack\n"));
249+
printf(_(" --backup-pg-log start backup pg_log directory\n"));
244250
printf(_("\nRestore options:\n"));
245251
printf(_(" --recovery-target-time time stamp up to which recovery will proceed\n"));
246252
printf(_(" --recovery-target-xid transaction ID up to which recovery will proceed\n"));

0 commit comments

Comments
 (0)