@@ -76,6 +76,8 @@ static int compareWalFileNames(const void *a, const void *b);
76
76
static void throttle (size_t increment );
77
77
static bool is_checksummed_file (const char * fullpath , const char * filename );
78
78
79
+ #define BACKUP_ALL_SNAPSHOTS ((SnapshotId)~0)
80
+
79
81
/* Was the backup currently in-progress initiated in recovery mode? */
80
82
static bool backup_started_in_recovery = false;
81
83
@@ -649,6 +651,8 @@ parse_basebackup_options(List *options, basebackup_options *opt)
649
651
bool o_snapshot = false;
650
652
651
653
MemSet (opt , 0 , sizeof (* opt ));
654
+ opt -> snapshot = BACKUP_ALL_SNAPSHOTS ;
655
+
652
656
foreach (lopt , options )
653
657
{
654
658
DefElem * defel = (DefElem * ) lfirst (lopt );
@@ -1156,7 +1160,7 @@ sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
1156
1160
}
1157
1161
1158
1162
/* Do not backup snapfs files */
1159
- if (is_snapfs_file (de -> d_name ))
1163
+ if (sfs_backend_snapshot != BACKUP_ALL_SNAPSHOTS && is_snapfs_file (de -> d_name ))
1160
1164
continue ;
1161
1165
1162
1166
snprintf (pathbuf , sizeof (pathbuf ), "%s/%s" , path , de -> d_name );
@@ -1395,7 +1399,8 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
1395
1399
SnapshotId current_snapshot ;
1396
1400
File file = -1 ;
1397
1401
1398
- current_snapshot = sfs_backend_snapshot != SFS_INVALID_SNAPSHOT ? sfs_backend_snapshot : ControlFile -> active_snapshot ;
1402
+ current_snapshot = sfs_backend_snapshot != SFS_INVALID_SNAPSHOT && sfs_backend_snapshot != BACKUP_ALL_SNAPSHOTS
1403
+ ? sfs_backend_snapshot : ControlFile -> active_snapshot ;
1399
1404
if (current_snapshot != SFS_INVALID_SNAPSHOT )
1400
1405
file = PathNameOpenFile (readfilename , O_RDONLY |PG_BINARY );
1401
1406
@@ -1562,7 +1567,9 @@ sendFile(const char *readfilename, const char *tarfilename, struct stat *statbuf
1562
1567
}
1563
1568
1564
1569
/* Remove information about snapshots from control file */
1565
- if (SFS_KEEPING_SNAPSHOT () && strcmp (readfilename , XLOG_CONTROL_FILE ) == 0 )
1570
+ if (SFS_KEEPING_SNAPSHOT ()
1571
+ && sfs_backend_snapshot != BACKUP_ALL_SNAPSHOTS
1572
+ && strcmp (readfilename , XLOG_CONTROL_FILE ) == 0 )
1566
1573
{
1567
1574
ControlFileData * ctl = (ControlFileData * )buf ;
1568
1575
ctl -> oldest_snapshot = 1 ;
0 commit comments