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)
321321 while (errno = 0 , (arcde = readdir (arcdir )) != NULL )
322322 {
323323 /*
324- * We ignore the timeline part of the XLOG segment identifiers in
324+ * We ignore the timeline part of the WAL segment identifiers in
325325 * deciding whether a segment is still needed. This ensures that
326326 * we won't prematurely remove a segment from a parent timeline.
327327 * We could probably be a little more proactive about removing
@@ -332,10 +332,13 @@ delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli)
332332 * decide which ones are earlier than the exclusiveCleanupFileName
333333 * file. Note that this means files are not removed in the order
334334 * they were originally written, in case this worries you.
335+ *
336+ * We also should not forget that WAL segment can be compressed.
335337 */
336338 if (IsXLogFileName (arcde -> d_name ) ||
337339 IsPartialXLogFileName (arcde -> d_name ) ||
338- IsBackupHistoryFileName (arcde -> d_name ))
340+ IsBackupHistoryFileName (arcde -> d_name ) ||
341+ IsCompressedXLogFileName (arcde -> d_name ))
339342 {
340343 if (XLogRecPtrIsInvalid (oldest_lsn ) ||
341344 strncmp (arcde -> d_name + 8 , oldestSegmentNeeded + 8 , 16 ) < 0 )
Original file line number Diff line number Diff line change @@ -267,6 +267,11 @@ typedef struct
267267#define XLogDataFromLSN (data , xlogid , xrecoff ) \
268268 sscanf(data, "%X/%X", xlogid, xrecoff)
269269
270+ #define IsCompressedXLogFileName (fname ) \
271+ (strlen(fname) == XLOG_FNAME_LEN + strlen(".gz") && \
272+ strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && \
273+ strcmp((fname) + XLOG_FNAME_LEN, ".gz") == 0)
274+
270275/* directory options */
271276extern char * backup_path ;
272277extern char backup_instance_path [MAXPGPATH ];
You can’t perform that action at this time.
0 commit comments