File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli)
321
321
while (errno = 0 , (arcde = readdir (arcdir )) != NULL )
322
322
{
323
323
/*
324
- * We ignore the timeline part of the XLOG segment identifiers in
324
+ * We ignore the timeline part of the WAL segment identifiers in
325
325
* deciding whether a segment is still needed. This ensures that
326
326
* we won't prematurely remove a segment from a parent timeline.
327
327
* We could probably be a little more proactive about removing
@@ -332,10 +332,13 @@ delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli)
332
332
* decide which ones are earlier than the exclusiveCleanupFileName
333
333
* file. Note that this means files are not removed in the order
334
334
* they were originally written, in case this worries you.
335
+ *
336
+ * We also should not forget that WAL segment can be compressed.
335
337
*/
336
338
if (IsXLogFileName (arcde -> d_name ) ||
337
339
IsPartialXLogFileName (arcde -> d_name ) ||
338
- IsBackupHistoryFileName (arcde -> d_name ))
340
+ IsBackupHistoryFileName (arcde -> d_name ) ||
341
+ IsCompressedXLogFileName (arcde -> d_name ))
339
342
{
340
343
if (XLogRecPtrIsInvalid (oldest_lsn ) ||
341
344
strncmp (arcde -> d_name + 8 , oldestSegmentNeeded + 8 , 16 ) < 0 )
Original file line number Diff line number Diff line change @@ -257,6 +257,11 @@ typedef union DataPage
257
257
#define XLogDataFromLSN (data , xlogid , xrecoff ) \
258
258
sscanf(data, "%X/%X", xlogid, xrecoff)
259
259
260
+ #define IsCompressedXLogFileName (fname ) \
261
+ (strlen(fname) == XLOG_FNAME_LEN + strlen(".gz") && \
262
+ strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && \
263
+ strcmp((fname) + XLOG_FNAME_LEN, ".gz") == 0)
264
+
260
265
/* directory options */
261
266
extern char * backup_path ;
262
267
extern char backup_instance_path [MAXPGPATH ];
You can’t perform that action at this time.
0 commit comments