mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-28 09:33:54 +02:00
Remove delete_all from delete_walfiles()
This commit is contained in:
parent
0dba271511
commit
777ab09f29
21
delete.c
21
delete.c
@ -15,8 +15,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static int pgBackupDeleteFiles(pgBackup *backup);
|
static int pgBackupDeleteFiles(pgBackup *backup);
|
||||||
static void delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli,
|
static void delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli);
|
||||||
bool delete_all);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
do_delete(time_t backup_id)
|
do_delete(time_t backup_id)
|
||||||
@ -108,7 +107,7 @@ do_delete(time_t backup_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_walfiles(oldest_lsn, oldest_tli, true);
|
delete_walfiles(oldest_lsn, oldest_tli);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
@ -200,7 +199,7 @@ do_retention_purge(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Purge WAL files */
|
/* Purge WAL files */
|
||||||
delete_walfiles(oldest_lsn, oldest_tli, true);
|
delete_walfiles(oldest_lsn, oldest_tli);
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
parray_walk(backup_list, pgBackupFree);
|
parray_walk(backup_list, pgBackupFree);
|
||||||
@ -280,13 +279,16 @@ pgBackupDeleteFiles(pgBackup *backup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete WAL segments up to oldest_lsn.
|
* Deletes WAL segments up to oldest_lsn or all WAL segments (if all backups
|
||||||
|
* was deleted and so oldest_lsn is invalid).
|
||||||
*
|
*
|
||||||
* If oldest_lsn is invalid function exists. But if delete_all is true then
|
* oldest_lsn - if valid, function deletes WAL segments, which contain lsn
|
||||||
* WAL segements will be deleted anyway.
|
* older than oldest_lsn. If it is invalid function deletes all WAL segments.
|
||||||
|
* oldest_tli - is used to construct oldest WAL segment in addition to
|
||||||
|
* oldest_lsn.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli, bool delete_all)
|
delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli)
|
||||||
{
|
{
|
||||||
XLogSegNo targetSegNo;
|
XLogSegNo targetSegNo;
|
||||||
char oldestSegmentNeeded[MAXFNAMELEN];
|
char oldestSegmentNeeded[MAXFNAMELEN];
|
||||||
@ -297,9 +299,6 @@ delete_walfiles(XLogRecPtr oldest_lsn, TimeLineID oldest_tli, bool delete_all)
|
|||||||
char min_wal_file[MAXPGPATH];
|
char min_wal_file[MAXPGPATH];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (XLogRecPtrIsInvalid(oldest_lsn) && !delete_all)
|
|
||||||
return;
|
|
||||||
|
|
||||||
max_wal_file[0] = '\0';
|
max_wal_file[0] = '\0';
|
||||||
min_wal_file[0] = '\0';
|
min_wal_file[0] = '\0';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user