Skip to content

Commit 23f4eaa

Browse files
committed
Add --disable-ptrack-clear for postgres without ptrack.
1 parent 20a892e commit 23f4eaa

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

backup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ do_backup_database(parray *backup_list, pgBackupOption bkupopt)
146146
}
147147

148148
/* clear ptrack files for FULL and DIFF backup */
149-
if (current.backup_mode != BACKUP_MODE_DIFF_PTRACK)
149+
if (current.backup_mode != BACKUP_MODE_DIFF_PTRACK && !disable_ptrack_clear)
150150
pg_ptrack_clear();
151151

152152
/* start stream replication */

expected/option.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ 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
2122

2223
Backup options:
2324
-b, --backup-mode=MODE full,page,ptrack

pg_arman.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static int keep_data_generations = KEEP_INFINITE;
3636
static int keep_data_days = KEEP_INFINITE;
3737
int num_threads = 1;
3838
bool stream_wal = false;
39+
bool disable_ptrack_clear = false;
3940
static bool backup_validate = false;
4041

4142
/* restore configuration */
@@ -60,6 +61,7 @@ static pgut_option options[] =
6061
{ 'b', 'c', "check", &check },
6162
{ 'i', 'j', "threads", &num_threads },
6263
{ 'b', 8, "stream", &stream_wal },
64+
{ 'b', 9, "disable-ptrack-clear", &disable_ptrack_clear },
6365
/* backup options */
6466
{ 'f', 'b', "backup-mode", opt_backup_mode, SOURCE_ENV },
6567
{ 'b', 'C', "smooth-checkpoint", &smooth_checkpoint, SOURCE_ENV },
@@ -232,6 +234,7 @@ pgut_help(bool details)
232234
printf(_(" -c, --check show what would have been done\n"));
233235
printf(_(" -j, --threads=NUM num threads for backup and restore\n"));
234236
printf(_(" --stream use stream for save/restore WAL during backup\n"));
237+
printf(_(" --disable-ptrack-clear disable clear ptrack for postgres without ptrack\n"));
235238
printf(_("\nBackup options:\n"));
236239
printf(_(" -b, --backup-mode=MODE full,page,ptrack\n"));
237240
printf(_(" -C, --smooth-checkpoint do smooth checkpoint before backup\n"));

pg_arman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ extern parray *backup_files_list;
210210

211211
extern int num_threads;
212212
extern bool stream_wal;
213+
extern bool disable_ptrack_clear;
213214

214215
/* in backup.c */
215216
extern int do_backup(pgBackupOption bkupopt);

0 commit comments

Comments
 (0)