diff --git a/backup.c b/backup.c index ba0586d1..8acd6490 100644 --- a/backup.c +++ b/backup.c @@ -146,7 +146,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt) } /* clear ptrack files for FULL and DIFF backup */ - if (current.backup_mode != BACKUP_MODE_DIFF_PTRACK) + if (current.backup_mode != BACKUP_MODE_DIFF_PTRACK && !disable_ptrack_clear) pg_ptrack_clear(); /* start stream replication */ diff --git a/expected/option.out b/expected/option.out index 4a01617d..399b8208 100644 --- a/expected/option.out +++ b/expected/option.out @@ -18,6 +18,7 @@ Common Options: -c, --check show what would have been done -j, --threads=NUM num threads for backup and restore --stream use stream for save/restore WAL during backup + --disable-ptrack-clear disable clear ptrack for postgres without ptrack Backup options: -b, --backup-mode=MODE full,page,ptrack diff --git a/pg_arman.c b/pg_arman.c index 9a575503..7fb6814d 100644 --- a/pg_arman.c +++ b/pg_arman.c @@ -36,6 +36,7 @@ static int keep_data_generations = KEEP_INFINITE; static int keep_data_days = KEEP_INFINITE; int num_threads = 1; bool stream_wal = false; +bool disable_ptrack_clear = false; static bool backup_validate = false; /* restore configuration */ @@ -60,6 +61,7 @@ static pgut_option options[] = { 'b', 'c', "check", &check }, { 'i', 'j', "threads", &num_threads }, { 'b', 8, "stream", &stream_wal }, + { 'b', 9, "disable-ptrack-clear", &disable_ptrack_clear }, /* backup options */ { 'f', 'b', "backup-mode", opt_backup_mode, SOURCE_ENV }, { 'b', 'C', "smooth-checkpoint", &smooth_checkpoint, SOURCE_ENV }, @@ -232,6 +234,7 @@ pgut_help(bool details) printf(_(" -c, --check show what would have been done\n")); printf(_(" -j, --threads=NUM num threads for backup and restore\n")); printf(_(" --stream use stream for save/restore WAL during backup\n")); + printf(_(" --disable-ptrack-clear disable clear ptrack for postgres without ptrack\n")); printf(_("\nBackup options:\n")); printf(_(" -b, --backup-mode=MODE full,page,ptrack\n")); printf(_(" -C, --smooth-checkpoint do smooth checkpoint before backup\n")); diff --git a/pg_arman.h b/pg_arman.h index 8114cda1..71f7a17c 100644 --- a/pg_arman.h +++ b/pg_arman.h @@ -210,6 +210,7 @@ extern parray *backup_files_list; extern int num_threads; extern bool stream_wal; +extern bool disable_ptrack_clear; /* in backup.c */ extern int do_backup(pgBackupOption bkupopt);