@@ -99,9 +99,6 @@ static int basebackup_read_file(int fd, char *buf, size_t nbytes, off_t offset,
99
99
/* Was the backup currently in-progress initiated in recovery mode? */
100
100
static bool backup_started_in_recovery = false;
101
101
102
- /* Relative path of temporary statistics directory */
103
- static char * statrelpath = NULL ;
104
-
105
102
/* Total number of checksum failures during base backup. */
106
103
static long long int total_checksum_failures ;
107
104
@@ -131,9 +128,8 @@ struct exclude_list_item
131
128
static const char * const excludeDirContents [] =
132
129
{
133
130
/*
134
- * Skip temporary statistics files. PG_STAT_TMP_DIR must be skipped even
135
- * when stats_temp_directory is set because PGSS_TEXT_FILE is always
136
- * created there.
131
+ * Skip temporary statistics files. PG_STAT_TMP_DIR must be skipped
132
+ * because extensions like pg_stat_statements store data there.
137
133
*/
138
134
PG_STAT_TMP_DIR ,
139
135
@@ -237,7 +233,6 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
237
233
StringInfo labelfile ;
238
234
StringInfo tblspc_map_file ;
239
235
backup_manifest_info manifest ;
240
- int datadirpathlen ;
241
236
242
237
/* Initial backup state, insofar as we know it now. */
243
238
state .tablespaces = NIL ;
@@ -250,8 +245,6 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
250
245
Assert (CurrentResourceOwner == NULL );
251
246
CurrentResourceOwner = ResourceOwnerCreate (NULL , "base backup" );
252
247
253
- datadirpathlen = strlen (DataDir );
254
-
255
248
backup_started_in_recovery = RecoveryInProgress ();
256
249
257
250
labelfile = makeStringInfo ();
@@ -279,18 +272,6 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
279
272
ListCell * lc ;
280
273
tablespaceinfo * ti ;
281
274
282
- /*
283
- * Calculate the relative path of temporary statistics directory in
284
- * order to skip the files which are located in that directory later.
285
- */
286
- if (is_absolute_path (pgstat_stat_directory ) &&
287
- strncmp (pgstat_stat_directory , DataDir , datadirpathlen ) == 0 )
288
- statrelpath = psprintf ("./%s" , pgstat_stat_directory + datadirpathlen + 1 );
289
- else if (strncmp (pgstat_stat_directory , "./" , 2 ) != 0 )
290
- statrelpath = psprintf ("./%s" , pgstat_stat_directory );
291
- else
292
- statrelpath = pgstat_stat_directory ;
293
-
294
275
/* Add a node for the base directory at the end */
295
276
ti = palloc0 (sizeof (tablespaceinfo ));
296
277
ti -> size = -1 ;
@@ -1310,19 +1291,6 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
1310
1291
if (excludeFound )
1311
1292
continue ;
1312
1293
1313
- /*
1314
- * Exclude contents of directory specified by statrelpath if not set
1315
- * to the default (pg_stat_tmp) which is caught in the loop above.
1316
- */
1317
- if (statrelpath != NULL && strcmp (pathbuf , statrelpath ) == 0 )
1318
- {
1319
- elog (DEBUG1 , "contents of directory \"%s\" excluded from backup" , statrelpath );
1320
- convert_link_to_directory (pathbuf , & statbuf );
1321
- size += _tarWriteHeader (sink , pathbuf + basepathlen + 1 , NULL ,
1322
- & statbuf , sizeonly );
1323
- continue ;
1324
- }
1325
-
1326
1294
/*
1327
1295
* We can skip pg_wal, the WAL segments need to be fetched from the
1328
1296
* WAL archive anyway. But include it as an empty directory anyway, so
0 commit comments